Ian VanSchooten
November 2016
A maintainable, scalable, bug-free, high-performance
web application
Icons made by Freepik from www.flaticon.com are licensed CC 3.0 BY
A maintainable, scalable, bug-free, high-performance
web application
A maintainable, scalable, bug-free, high-performance
web application
A maintainable, scalable, bug-free, high-performance
web application
A maintainable, scalable, bug-free, high-performance
web application
I need to organize my JavaScript and get it onto my page.
Asynchronous Module Definition (AMD)
CommonJS (CJS)
ECMAScript Modules (ESM, ES6, ES2015)
var foo = require('foo');import foo from 'foo';define(["foo"], function (foo) {
return {
// your code goes here
};
});ES6, Vanilla, AMD, CommonJS
Built on draft ES6 loader specification
Used in Angular 2, Auralia
Bundlers
CommonJS
Bundle into one (or more) standard JS scripts
I have a lot of JavaScript files/modules now.
CommonJS
AMD, CommonJS, ES6
Can also load other assets like CSS
ES6 modules, others with work
Promises smaller bundle sizes, "tree shaking"
Similar to Webpack
Less complicated setup
I want to use JavaScript modules that other people have written.
Downloads source files to your HDD
Mainly CommonJS
Powerful tooling
Focuses on ES6 modules
Uses SystemJS module loader
New client using npm registry
Faster and simpler than npm
I want to write code in a language or version of JavaScript that
not all browsers support.
i.e. ES6, ES2017, TypeScript, CoffeeScript
Typed superset of JavaScript
Developed by Microsoft
Used by Angular 2
Fast, opinionated alternative to Babel
Cleaner syntax, influenced ES6
My JavaScript bundle is very big.
Battle tested, most widely used
Most bundlers include UglifyJS or make it easy to add
Not yet compatible with pure ES6
Plugin for Babel (might be renamed to babel-minify)
ES6 compatible
Super-early beta phase tool
I want to catch bugs before I ship code to my users.
BDD testing framework
Popular, requires an assertion library, like Chai
Runs tests concurrently in separate threads
Commonly used with React, allows snapshotting
Test framework from jQuery, used in Ember-cli
Simple testing without globals
More people have joined my team,
and they all use different styles.
Pluggable and configurable
237 Core rules, many more in plugins
CSS Linter
Similar architecture/setup to ESLint
Linting for TypeScript
CSS is awful.
OK, maybe not awful, but we can do better.
Original CSS preprocessor from Twitter
Similar to Less, generally more popular today
Originally written in Ruby, then C++, now Dart
Transform CSS with JavaScript
Large ecosystem of plugins
Autoprefixer, CSSNext, CSS Modules, StyleLint
I need to manage all this bundling, minifying, transpiling, processing css, testing, & linting.
Sequential operations, config heavy
Writes intermediate steps to disk
Uses streams instead of files, faster than grunt
Code-over-configuration
Simpler than grunt or gulp, still powerful
Chain scripts together, pass custom args, etc.
Very fast asset pipeline
Opinionated build tool, fast rebuild times
I've spent all my time setting up my workflow,
and forgotten what I wanted to build.
CLI for Angular 2 apps
Ember.js command line utility
Aurelia CLI for creating projects, bundling, etc.
Scaffolding tool for various projects
Command-line tool for Polymer projects.
Create React apps with no build configuration
Modules
A way to organize your code
Bundlers
Combine modules to load in the browser
Pkg Managers
Minifiers
Download and manage external dependencies
Remove unnecessary bits from code to reduce filesize
Transpilers
Allow us to write code that browsers don't understand
CSS Processors
Manipulate and extend stylesheets
Test Tools
Automate tests of our code
Linters
Establish shared style and avoid bad syntax
Task Runners
Put together all the steps to our workflow
CLIs
Make all the hard choices for us, set up the workflow
These slides are at: