JavaScript for Li...
Follow
Find tag "RequireJS"
345.9K views | +307 today
JavaScript for Line of Business Applications
Keeping track of current JavaScript Frameworks that help design your clientside Business Logic Layers.
Curated by Jan Hesse
Beam to my Inbox:
Your new post is loading...
Your new post is loading...
Scoop.it!

Reusable UI widgets using RequireJS and Knockout

Reusable UI widgets using RequireJS and Knockout | JavaScript for Line of Business Applications | Scoop.it

Requirements
What I needed to do was to find a way to reuse custom UI components (widgets) in the most transparent way. That meant for me that I should be able to:

* Not have to declare all of my widgets dependencies in each webpage it was needed.
* Have all widget code in their own files. This applies to JavaScript source as well as HTML templates.
* Have each widget specify its dependencies to other widgets so I can easily compose them.


Gather the tools
Using an MVW framework is always a good idea when trying to structure your Web UI code. It separates your JavaScript from your HTML views in a clear way, so I tried a few. What I finally ended up using was Knockout.js, because of its HTML templates with data-bind tags. That was making it easier for a designer to work with them without messing with Handlebars magic.

more...
No comment yet.
Scoop.it!

RequireJS.NET

RequireJS.NET | JavaScript for Line of Business Applications | Scoop.it
RequireJS for .NET brings asynchronous JavaScript loading and flexible js bundling configuration to ASP.NET MVC. You can now have all the benefits of RequireJS and more in a way that is easy to use and fully integrated with ASP.NET
more...
No comment yet.
Scoop.it!

Creating An Application With Sails, Angular and Require.js

Creating An Application With Sails, Angular and Require.js | JavaScript for Line of Business Applications | Scoop.it

There are a lot of really good client-side and server-side JavaScript frameworks popping up, but there are not many in-depth articles on how they fit together. This series will look at a very specific stack and how it can be used to create an application.


Here is what we will cover:

* Starting The Sails Project
* Sails Server-Side Views
* Adding dependencies
* Angular Controllers
* Sails Models
* Syncing With The Server

more...
No comment yet.
Scoop.it!

Requiring Versus Browserifying Angular

Requiring Versus Browserifying Angular | JavaScript for Line of Business Applications | Scoop.it

The blueprint Angular offers is fundamentally quite simple – JavaScript doesn’t have a module system, so Angular provides one for you. Angular ensures that all of your JavaScript code is ready, loaded and available when your application runs. It does this primarily via dependency injection.

The next logical step would be to break these controllers, services, and anything else we can out into separate files. This would be the physical project structure that mimics the coded one. We generally have two options here – Browserify and RequireJS

more...
No comment yet.
Scoop.it!

Reusing require.js modules in Node.js

Reusing require.js modules in Node.js | JavaScript for Line of Business Applications | Scoop.it
A tutorial on how to reuse require.js AMD modules directly in Node.js at the same time as using the standard Node's modules using AMDrequire library.
more...
No comment yet.
Scoop.it!

Angular JS localization with Require JS i18n module

When we started working with AngularJS, one of the first non-trivial challenges we were faced with was to find a way to localize the text in our app.

We had a few basic requirements for the localization solution:

  1. Will not require any changes to my existing controllers.
  2. Will not polute the current $scope.
  3. Be able to define the desired string directly on the markup with a simple syntax.
  4. Be defined as a module that can be minified and compiled with RequireJS.

Some brief research did not produce any options we were completely satisfied with. We then considered the RequireJS i18n module. It is a very simple and elegant solution that's worked very well for me in my previous projects, so I set out to write a small module that will bridge the gap between this module and my Angular JS code and views.

more...
No comment yet.
Scoop.it!

Small.JS

Small.JS | JavaScript for Line of Business Applications | Scoop.it

The Javascript world is dominated by frameworks, and it is because of our reluctance to having dependencies in our libraries. If you are going to write a Javascript library, you have two options:

  1. Depend on a proven framework.
  2. Depend on no one.

If you choose option #1, you contribute to the worship of the framework.

If you choose option #2, you are faced with a problem. If you make it too small, it may not be useful enough to warrant a download (are you download-worthy?). What happens sometimes is a set of smaller functionalities get packaged up into a larger library to give users more value for the download. Another thing that tends to happen is established libraries get bigger over time as new techniques are discovered and new features invented, because this makes it easier for existing users.


As someone who likes to write small libraries, the dream for me, is this: I want easy dependencies: regardless of how many dependencies and/or nested dependencies my project has, I want to be able tell people "using my library is as easy as 1-2-3."

What I want is something like NPM.

Jan Hesse's insight:

http://smalljs.org/

more...
No comment yet.
Scoop.it!

Modular Workflow with Require.js

Modular Workflow with Require.js | JavaScript for Line of Business Applications | Scoop.it

Awesome, It Works!
RequireJS Is The Best

Please Tell Me More About AMD


Is That It?
Nope, There Are Many Ways To Define an AMD Module

Check Out More Module Definitions

more...
No comment yet.
Scoop.it!

And just like that Grunt and RequireJS are out, it's all about Gulp and Browserify now

And just like that Grunt and RequireJS are out, it's all about Gulp and Browserify now | JavaScript for Line of Business Applications | Scoop.it

In a demonstration of how insane the Javascript world is, a revolution happened last week and it looks like Grunt was dethroned as the go-to task -runner. But wait you may say, wasn’t the Node and Grunt revolution just beginning? After all Grunt had just managed to find its way to job descriptions. Apparently we weren’t done revolutionizing.

And what I saw was that it is indeed much better, much more intuitive to Node.js devs and simpler to use. And that concluded it for me.

So now  instead of Grunt’s harder to understand syntaxes and laborious pre-config, we have this...

more...
No comment yet.
Scoop.it!

Using ColtJS in Modular Single Page Applications

Using ColtJS in Modular Single Page Applications | JavaScript for Line of Business Applications | Scoop.it

Building modular single page applications that are scalable has always been a nontrivial task, but with proper tooling, achieving this is a lot easier than you think.

A new framework called ColtJS allows the easy development of JavaScript applications using Asynchronous Module Definition (AMD). It depends upon the highly popular script loader, RequireJS, and aims to be lightweight, flexible and highly efficient.

more...
No comment yet.
Scoop.it!

Creating A RequireJS Service For AngularJS Applications

Ben Nadel demonstrates how to use RequireJS inside an AngularJS application by calling the $apply() methods alerting AngularJS to any relevant changes.

As far as AngularJS is concerned, everything "happens" inside of the $apply / $digest lifecycle. This is the period in which AngularJS performs its "dirty checking" of the $scope data, which may or may not precipitate the invocation of various watchers and data-bindings. As such, if your code doesn't trigger an $apply / $digest, AngularJS doesn't know that your code has changed anything.

When you load RequireJS modules, RequireJS loads the target JavaScript files asynchronously before invoking your callbacks asynchronously. This asynchronous nature means that your RequireJS callbacks will be invoked outside of the AngularJS lifecycle. As such, you have to explicitly call $scope.$apply() within your callbacks so that AngularJS will propagate your asynchronous changes throughout the rest of the application.

more...
No comment yet.
Scoop.it!

Durandal’s Edge

Durandal’s Edge | JavaScript for Line of Business Applications | Scoop.it

With so many SPA-style frameworks emerging in the last couple years, you may wonder what makes Durandal unique or different. Why would you want to choose it for your next project?  I’d like to share a few key points to that end…

Rather than re-invent the wheel, Durandal starts by combining and building on top of three existing libraries. Each of these libraries is very mature, has a large, active community and was strategically chosen because it meets one specific need very well. First we start with jQuery. In some ways you can think of it as a better DOM or the “missing JavaScript core library”. Next, we add in RequireJS, which gives us rich, declarative JavaScript modules. Finally, Knockout provides us with powerful two-way data-binding.

With these three libraries as a foundation, Durandal constructs a thin integration layer and transforms them into a powerful SPA framework. In addition to strategically connecting these libraries, Durandal adds new functionality. Some things Durandal adds are:  a client-side router, rich view composition, screen state management, pub/sub, simple conventions, modals/message boxes and more…

more...
No comment yet.
Scoop.it!

Building a single-page app, one page at time

Building a single-page app, one page at time | JavaScript for Line of Business Applications | Scoop.it

In addition to requiring that music is continuously playable, we also must provide server-rendered versions of our public pages – this makes our content accessible to search engines and screen readers, simplifies linking and sharing, and results in faster load times through our cache system. This requirement is a large part why of we avoided earlier solutions like hashbang URLs or iframes, and waited for HTML5 history to be widely available. We also wanted a transition path that didn’t require a full rewrite or a big launch to inaugurate the new version. Building a second version of the app in parallel to maintaining the first was just not an option for our four-person dev team.

These requirements pushed us toward more adaptable technologies and newer libraries. Over the course of several months we began using Backbone.js to manage our models and view logic, Require.js to handle dependencies, and several flavors of Mustache for templating, keeping these updates in the production codebase without radically changing the application or UI. These updates readied us for futher abstraction into a single-page application.

more...
No comment yet.
Scoop.it!

Kendo UI SPA and Require.js

Kendo UI SPA and Require.js | JavaScript for Line of Business Applications | Scoop.it
Unlike some other SPA frameworks, Kendo's SPA implementation doesn't do much to dictate your code layout. In this article we will see one way to lay out your SPA application using Require.js and the kendo-template Require.js plugin.
more...
No comment yet.
Scoop.it!

Require.js packages for building large scale angular applications

Require.js packages for building large scale angular applications | JavaScript for Line of Business Applications | Scoop.it

Require.js is one of my favorite ways to work with large JavaScript applications. It allows you to build AMD (asynchronous module definition) style modules to break up your application into small reusable modules. This is a desirable feature in large code bases.

It's important to know when and why you may consider require.js. If you're working on a small application that doesn't have a need for many files and little logic, you may or may not need the overhead of require.js. However, you still can get value out of it's organization and structure it provides you.

more...
No comment yet.
Scoop.it!

Lazy loading AngularJS components using Providers

Lazy loading AngularJS components using Providers | JavaScript for Line of Business Applications | Scoop.it

In most of the example applications that I've seen, all application script files are loaded upfront i.e. all JavaScript files are loaded when the user accesses application. I get annoyed by this approach; why should all the components be loaded upfront when the probability of user accessing the entire application is very less. How does one architect a multi-page application using Angular? What would be the size of the application after minifying all the JavaScript files. Most importantly how does one load the components lazily. I've used RequireJS in my previous projects and it allows you to load components on demand; the idea is to load components based on the selected route. I've tried a similar approach with Angular using 'resolve' property in the $routeProvider.

more...
No comment yet.
Scoop.it!

Getting Started with Browserify

Getting Started with Browserify | JavaScript for Line of Business Applications | Scoop.it

This article introduces the Browserify tool. It also shows how Browserify can be integrated with Grunt and Gulp.

any of us now work with JavaScript modules – independently functioning components that come together to work as a cohesive whole, yet can happily have any component replaced without causing armageddon. Many of us have been using the AMD module pattern and RequireJS to accomplish this neatly.

more...
No comment yet.
Scoop.it!

Introducing Atomify - A New Standard of Modularity

Introducing Atomify - A New Standard of Modularity | JavaScript for Line of Business Applications | Scoop.it

Everyone wants to write modular code, but it's not always easy. In the world of front end web development things like stylesheets, markup, and assets are some of the most easily identifiable obstacles to writing truly modular code. Add to that monolithic libraries like jQuery, Angular, etc. and it can be tempting to throw your hands up and simply dump all the code for an application into a single place.

Atomify makes overcoming these obstacles easy, and this post will begin to show you how.


So what, exactly, does it do?

  • Enables you to build properly atomic front end components
  • Brings a dependency graph to your CSS, removing the need for impossibly long and disorganized stylesheets
  • Unifies the bundling of your code, templates and styles into one easily configurable tool
  • Makes full modularity the default, instead of a complicated pipe dream
more...
No comment yet.
Scoop.it!

Introduction to Component

Introduction to Component | JavaScript for Line of Business Applications | Scoop.it

Component is a front-end JavaScript package manager developed by the prolific Tj Holowaychuk. It embodies the philosophy of small modules and is designed to manage assets as well as JavaScript. Currently, there exist over 1600 “components”. Although there are more popular JS package managers than Component, I chose to cover it because I love an underdog.

Jan Hesse's insight:

http://smalljs.org/package-managers/component-part-2/

more...
No comment yet.
Scoop.it!

Creating standalone JavaScript library builds with browserify, watchify, and uglify-js

Creating standalone JavaScript library builds with browserify, watchify, and uglify-js | JavaScript for Line of Business Applications | Scoop.it

Recently I had the opportunity to use Browserify as one of the tools for creating a JavaScript module for a client that is building a mapping product for architects and urban planners.

In that project I used Browserify and npm scripts to bundle the module into a file the client could use as a standalone library that could be added to any web page that needed to use the tool.

It was a fairly straightforward and flexible build process, and here I'll outline a similar structure that you could use in your projects.

Our example project will be named Pizza, because our example library will do nothing but return the string 'Pizza'. Deal with it.

more...
No comment yet.
Scoop.it!

Post Series on Building a Test-Driven Grocery List Application

I decided to dedicate this series to building a test-driven application that would allow me to create a Grocery List. I figured it will be a small enough application to not get muddled down in large, complex requirements and several moving parts but still provide a real-life example of a CRUD-based application.

A Grocery List application is also something I have wanted to make for some time. We still, as a household, create a grocery list with pen and paper and take it in hand to the store. Nothing wrong with that, aside from the general user error of a)forgetting the list at home, and the user experience oversight of b) not being able to split up and cover parts of the list as a group. So, I thought it may be handy to have a web-based application that my family could add to, remove from and have available on the one thing we never leave the house without: attitudes. No. smartphones.

 

* Part I – Introduction
* Part II – Feature: Add Item
* Part III – Feature: Mark-Off Item
* Part IV – Feature: List-Item-Controller
* Part V – Feature: List-Controller Refactoring
* Part VI – Back to Passing
* Part VII – Remove Item
* Part VIII – Bug Fixing
* Part IX – Persistence
* Part X – It Lives!

more...
No comment yet.
Scoop.it!

Modular JavaScript with RequireJS & Browserify

Modular JavaScript with RequireJS & Browserify | JavaScript for Line of Business Applications | Scoop.it

1. Who's talking?
2. The dark past
3. CommonJS & AMD? What is this??
4. RequireJS
5. Browserify
6. UMD
7. What's next?

more...
Scoop.it!

Sample Mobile Application with AngularJS

Sample Mobile Application with AngularJS | JavaScript for Line of Business Applications | Scoop.it

In recent months, I have been sharing different versions of the Employee Directory sample application built with different technology stacks, different frameworks, and different back-end (REST services) implementations. Recent versions include:

Employee Directory with Backbone.js, RequireJS, and Twitter BootstrapEmployee Directory with Backbone.js, RequireJS, Topcoat and PhoneGap

A number of you have asked for a version of the application built with AngularJS. So here it is.

You can experience the application below...

more...
No comment yet.
Scoop.it!

Hands On Lab: Building a Multiple View Single Page Application (SPA)

Hands On Lab: Building a Multiple View Single Page Application (SPA) | JavaScript for Line of Business Applications | Scoop.it

In this hands-on lab you will learn how to build a simple multiple view Single Page Application (SPA).

You will start by building a simple html page and add jQuery, RequireJS to make it dynamic. Then you will add Durandal and Knockout to extend the single html page into a SPA that has a shell and two additional views and a navigation menu to navigate between the two.

 

 this hands-on lab, you will learn:

How to use RequireJS to bootstrap a javascript module for your html pageHow to configure and use Durandal to provide your javascript application a lifecycle.How to add multiple views, configure the routes and navigation to turn your single html page into a multiple view SPA.
more...
No comment yet.
Scoop.it!

Facilitate use of RequireJS in AngularJS with angularAMD

angularAMD simplifies the use of RequireJS in a AngularJS webapp, optionally supporting on-demand loading of 3rd party modules such as UI Bootstrap.

To see it in action, open your favorite Developer Tools for your browser and see controller and service javascripts being loaded as you changes the tab.

more...
No comment yet.