Kom i gang med ECMAScript2015 (ES6) ved hjelp av webpack og Babel
Webpack (the amazing module bundling Swiss army knife) er kort fortalt en pakkehåndterer og et front-end byggesystem som preprosesserer forskjellige webressurser og samler dem i en eller flere statiske pakker som så kan benyttes i klienten. Prosesseringen starter fra et gitt startpunkt (entry), typisk index.js eller main.js. Ut fra startpunktet bygger webpack en avhengighetsgraf basert på filer som er knyttet opp via ìmport, require, url'er i css og href i img tagger. Prosesseringen foregår via såkalte "loadere" - ganske likt "tasks" i andre byggeverktøy, som Gulp.
Ved hjelp av Babel transformeres es6 til es5, som de fleste moderne nettlesere kan kjøre.
Hva trenger vi
- webpack
- webpack-dev-server
- babel-core; Node API and require hook
- babel-loader; transpiling JavaScript files using Babel and webpack.
- babel-preset-es2015; Compile ES2015 to ES5
- babel-preset-stage-0; Enable ES7
- babel-polyfill; which when required, sets you up with a full ES2015-ish environment
- babel-runtime; allows us to require only the features we need when distributing our application without polluting the global scope
- babel-plugin-transform-runtime; runtime poyfill.
- moment; parse, validate, manipulate, and display dates in JavaScript
Opprett et prosjekt og installer webpack og Babel
NodeJS må være installert på forhånd og det forutsettes at du har grunnleggende kunnskap om NodeJS.
Prosjektstruktur
mkdir es6-komigang
cd es6-komigang
mkdir src
mkdir src/js
mkdir src/js/components
npm init -y
Prosjektstruktur dersom du følger hele eksemplet
|
+-- src
| +-- html
| +-- js
| | +-- components
| +-- stylesheets
| | +-- base
| | +-- components
| | +-- layout
| | +-- pages
| | +-- themes
| | +-- utils
| | +-- vendor
+-- test
| +-- js
| | +-- components
+-- stub-server
| +-- data
+-- config
Installer nødvendige pakker
# webpack
npm install --save-dev webpack webpack-dev-server
# babel-core and babel-loader
npm install --save-dev babel-core babel-loader
# ES2015/ES6
npm install --save-dev babel-preset-es2015
# ES7
npm install --save-dev babel-preset-stage-0
# Runtime support
npm install --save babel-polyfill
npm install --save babel-runtime
npm install --save-dev babel-plugin-transform-runtime
# ES6 Promise, for node < v4
npm install --save dev es6-promise
# 3'dje parts bibliotek. Benyttes for å demonstrere splitting av JavaScript
npm install --save moment
Dette gir følgende package.json
i prosjektkatalogen:
{
"name": "es6-komigang",
"version": "0.0.1",
"description": "Kom i gang med ES6 ved hjelp av webpack og Babel",
"main": "webpack.config.js",
"dependencies": {
"babel-polyfill": "^6.2.0",
"babel-runtime": "^6.2.0",
"moment": "^2.10.6"
},
"devDependencies": {
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-plugin-transform-runtime": "^6.1.18",
"babel-preset-es2015": "^6.1.18",
"babel-preset-stage-0": "^6.1.18",
"es6-promise": "^3.0.2",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"scripts": {
"dev": "./node_modules/.bin/webpack-dev-server --hot --inline --module-bind --progress --color",
"build": "./node_modules/.bin/webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"webpack", "babel", "es6"
],
"author": "LOL",
"license": "ISC"
}
Opprett webpack konfigurasjonsfil, webpack.config.js
if (!global.Promise) {
global.Promise = require('es6-promise').polyfill();
}
const webpack = require('webpack');
const path = require('path');
module.exports = {
debug: true,
cache: true,
devtool: 'eval-source-map',
entry: {
app: [
'babel-polyfill',
path.join(__dirname, 'src/main.js')
],
vendor: [
'moment'
]
},
output: {
path : path.join(__dirname, 'dist'),
filename : '[name].js',
sourceMapFilename: '[file].map',
pathinfo : true,
publicPath : '/static/'
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', '.css', '.scss']
},
module: {
loaders: [
{
test: /\.js[x]?$/,
include: path.join(__dirname, "src"),
loader: 'babel-loader',
query: {
plugins: ['transform-runtime'],
presets: ['es2015', 'stage-0']
}
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
})
],
devServer: {
contentBase: './src',
port: 8080
}
};
En god beskrivelse av hvordan man setter opp Babel sammen med webpack finner du bl.a. her: Using ES6 and ES7 in the Browser, with Babel 6 and Webpack
Lag filen ./src/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>webpack ES6 demo</title>
</head>
<body>
<div id="container">
</div>
<script type="text/javascript" src="/static/vendor.js" charset="utf-8"></script>
<script type="text/javascript" src="/static/app.js" charset="utf-8"></script>
</body>
</html>
Lag filen ./src/components/Person.js
'use strict';
class Person {
constructor(_first, _last) {
this._first = _first;
this._last = _last;
}
get name() {
return this.first + ' ' + this.last;
}
toString() {
return this.name;
}
}
export default Person;
Lag filen ./src/main.js
'use strict';
import moment from 'moment';
import Person from './js/components/Person.js';
class App {
const run() {
const element = document.querySelector('#container');
const person = new Person('Leif', 'Olsen');
const content = document.createElement('h1');
content.classList.add('Person');
content.textContent = `${moment().format('YYYY-MM-DD HH:mm:ss')}: Yo ${person}`;
element.appendChild(content);
}
}
document.addEventListener('DOMContentLoaded', () => App.run());
Prøv ut koden
- Åpne et terminalvindu og start utviklingsserveren med følgende kommando:
npm run dev
- Åpne nettleseren og naviger til: http://localhost:8080/webpack-dev-server/
- Eventuelle endringer i koden kan du observere fortløpende i terminalvinduet og i nettleseren.
- Stopp serveren med
Ctrl+C
- Kjør kommandoen
npm run build
og verifiser at./dist
katalogen inneholder filenevendor.js
ogapp.js
Dette er i hovedsak utviklingsmiljøet du trenger for å komme i gang med ECMAScript 2015, ES6.
Resten av eksemplet forutsetter at du benytter Node-4.x eller Node-5.x!
Polyfills og Shims
TODO
Konfigurernig av Node og Webpack vha node-config
TODO
Rest-api med Node Express
Dette avsnittet viser hvordan man kan sette opp Node Express i et ES6-miljø og hvordan man setter opp en proxy fra webpack dev server til Node Express slik at man enkelt kan prøve ut ES6 fetch-api'et.
....... Ved koding av frontend kan man benytte Node Express som rest-api stubserver. ....... TODO
Forbedret arbeidsflyt med kodeanalyse, enhetstester og prosessering av statiske ressurser
I de neste avsnittene viser jeg hvordan man kan legge til flere nyttige verktøy.
EsLint
Kontinuerlig kodeanalyse for å avdekke potensielle problemer er greit å ha i arbeidsflyten. Til det trenger vi følgende:
- eslint; the linting tool
- eslint-config-standard; a set of configurations for eslint
- babel-eslint; a parser for eslint that teaches the linter about experimental features that aren’t in ES6.
- eslint-loader; eslint loader for webpack
npm install --save-dev eslint eslint-loader babel-eslint
Legg til følgende kode i webpack.config.js
preLoaders: [
{
test: /\.js[x]?$/,
include: [
path.join(__dirname, 'src'),
path.join(__dirname, 'test')
],
loaders: ['eslint']
}
],
I dette eksemplet konfigureres EsLint i webpack sin konfigurasjonsfil. Legg til følgende kode i ./webpack.config.js
eslint: {
'parser': 'babel-eslint',
'env': {
'browser': true,
'node': true,
'es6': true
},
'settings': {
'ecmascript': 7,
'jsx': true
},
'rules': {
'strict': 0,
'no-unused-vars': 2,
'camelcase': 1,
'indent': [1, 2],
'quotes': 0,
'linebreak-style': [2, 'unix'],
'semi': [2, 'always']
}
}
Linting av koden skjer kontinuerlig neste gang testserveren startes opp.
Statiske ressurser: HTML, CSS/SASS, fonter og grafiske elementer
Til prosessering av CSS/SASS og grafiske elementer trenger vi følgende.
- html-loader
- style-loader
- css-loader
- sass-loader
- node-sass
- file-loader
- url-loader
- extract-text-webpack-plugin
- autoprefixer
- postcss-loader
- resolve-url-loader
- autoprefixer
npm install --save-dev html-loader
npm install --save-dev style-loader
npm install --save-dev css-loader
npm install --save-dev sass-loader
npm install --save-dev node-sass
npm install --save-dev file-loader
npm install --save-dev url-loader
npm install --save-dev extract-text-webpack-plugin
npm install --save-dev autoprefixer postcss-loader
npm install --save-dev resolve-url-loader
npm install --save-dev autoprefixer
Legg til følgende kode i ./webpack.config.js
for å håndtere statiske ressurser.
if (!global.Promise) {
global.Promise = require('es6-promise').polyfill();
}
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const cssLoader = [
'css-loader?sourceMap',
'postcss-loader'
].join('!');
const sassLoader = [
'css-loader?sourceMap',
'postcss-loader',
'resolve-url-loader',
'sass-loader?sourceMap&expanded'
].join('!');
module.exports = {
entry: {
app: [
path.join(__dirname, 'src/main.scss'), // Styles
'babel-polyfill', // Babel requires some helper code to be run before your application
path.join(__dirname, 'src/main.js') // Add your application's scripts last
],
vendor: [
'moment'
]
},
....
devtool: 'eval-source-map',
loaders: [
....
{
test: /\.html$/,
include: path.join(__dirname, 'src/html'),
loader: "html-loader"
},
{
test: /\.scss$/,
include: path.join(__dirname, 'src'),
loader: ExtractTextPlugin.extract('style-loader', sassLoader)
},
{
test: /\.css$/,
include: path.join(__dirname, 'src'),
loader: ExtractTextPlugin.extract('style-loader', cssLoader)
},
// Images
// inline base64 URLs for <=16k images, direct URLs for the rest
{
test: /\.jpg/,
loader: 'url-loader',
query: {
limit: 16384,
mimetype: 'image/jpg'
}
},
{ test: /\.gif/, loader: 'url-loader?limit=16384&mimetype=image/gif' },
{ test: /\.png/, loader: 'url-loader?limit=16384&mimetype=image/png' },
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=16384&minetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader?limit=16384" }
],
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
}),
new ExtractTextPlugin('styles.css', {
disable: false,
allChunks: true
})
],
postcss: [
autoprefixer({
browsers: ['last 3 versions']
})
],
....
}
Loadere evalueres fra høyre mot venstre: SCSS-filer kompileres med SASS, deretter kjører autoprefixer, så produseres
en CSS-fil; ./dist/styles.css
. CSSfilen produseres på bakgrunn av de SASS/CSS-modulene som importeres i
./src/main.scss
og hvilke SASS/CSS-moduler som refereres i JavaScriptkoden; Person.js
og Person.scss
. Fordelen
med en CSSfil generert av webpack er at produsert CSSfil kun inneholder kode som man faktisk bruker. Hvordan dette
foregår i praksis er godt forklart i artikkelen
Smarter CSS builds with Webpack. CSS-strukturen som benyttes
i dette eksemplet er omtalt i Sass Guidelines, The 7-1 Pattern. Det meste ev
SASSkoden er hentet fra sass-boilerplate
som følger 7-1 mønsteret.
Oppdater filen ./src/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>webpack ES6 demo</title>
<link rel="stylesheet" href="/static/styles.css" />
</head>
<body>
<div id="container" class="container">
</div>
<script type="text/javascript" src="/static/vendor.js" charset="utf-8"></script>
<script type="text/javascript" src="/static/app.js" charset="utf-8"></script>
</body>
</html>
Restart serveren (Ctrl+C
, deretter npm run dev
)
Lag filen ./src/html/header.html
<div class="header">
<h2>Header ...</h3>
</div>
Lag filen ./src/html/footer.html
<div class="footer">
<h3>Footer ...</h3>
</div>
Organiseringen av SASS-koden bør følge 7-1 mønsteret nevnt i Sass Guidelines.
|
+-- src/
| +-- main.scss
| +-- stylesheets/
| | +-- base/
| | +-- components/
| | +-- layout/
| | +-- pages/
| | +-- themes/
| | +-- utils/
| | +-- vendor
Lag filen ./src/main.scss
@charset 'UTF-8';
// 1. Configuration and helpers
// No global Sass context, as suggested by http://bensmithett.com/smarter-css-builds-with-webpack/
// Only import what is strictly needed
// 2. Vendors
@import
'stylesheets/vendor/normalize.css';
// 3. Base stuff
@import
'stylesheets/base/base',
'stylesheets/base/typography',
'stylesheets/base/helpers';
// 4. Layout-related sections
@import
'stylesheets/layout/header',
'stylesheets/layout/footer';
// 5. Components
// 6. Page-specific styles
// 7. Themes
@import
'stylesheets/themes/default';
Lag filen ./src/stylesheets/layout/_header.scss
.header {
padding: 10px 0;
background-color: silver;
}
Lag filen ./src/stylesheets/layout/_footer.scss
.footer {
background-color: LightSteelBlue;
padding-top: 1px;
border-bottom: 3px solid #000;
}
Lag filen ./src/stylesheets/themes/_default.scss
html, body {
position: relative;
height: 100%;
min-height: 100%;
}
body {
background-color: green;
}
.container {
background-color: yellow;
height: 100%;
min-height: 100%;
}
Kopier normalize.css
fra normalize.css til mappen ./src/stylesheets/vendor/
Kopier _variables.css
fra sass-boilerplate til mappen ./src/stylesheets/utils/
Kopier _mixins.css
fra sass-boilerplate til mappen ./src/stylesheets/utils/
Kopier _base.scss
fra sass-boilerplate til mappen ./src/stylesheets/base/
. Legg til følgende i toppen av fila:
@import 'stylesheets/utils/variables';
@import 'stylesheets/utils/mixins';
Kopier _helpers.scss
fra sass-boilerplate til mappen ./src/stylesheets/base/
. Legg til følgende i toppen av fila:
@import 'stylesheets/utils/variables';
Kopier _typography.scss
fra sass-boilerplate til mappen ./src/stylesheets/base/
. Legg til følgende i toppen av fila:
@import 'stylesheets/utils/variables';
Last ned et ikon fra f.eks. findicons til mappen ./src/components/
og omdøp filen til smiley.png
.
Lag filen ./src/js/components/Person.scss
.Person {
background-image: url('smiley.png');
background-repeat: no-repeat;
background-position: 4px center;
background-size: auto 90%;
background-color: white;
padding-left: 54px;
}
Oppdater filen ./src/compoments/Person.js
'use strict';
import './Person.scss';
class Person {
constructor(_first, _last) {
this._first = _first;
this._last = _last;
}
get name() {
return this.first + ' ' + this.last;
}
toString() {
return this.name;
}
}
export default Person;
Oppdater filen ./src/main.js
'use strict';
import moment from 'moment';
import Person from './js/components/Person.js';
// Get header html, using import
import header from './html/header.html';
// Get footer html, using require
const footer = require('./html/footer.html');
class App {
const run() {
const element = document.querySelector('#container');
const person = new Person('Leif', 'Olsen');
// content
const content = document.createElement('h1');
content.classList.add('Person');
content.textContent = `${moment().format('YYYY-MM-DD HH:mm:ss')}: Yo ${person}`;
element.appendChild(content);
// Append header
content.insertAdjacentHTML('beforebegin', header);
// Append footer
content.insertAdjacentHTML('afterend', footer);
}
}
// Start
document.addEventListener('DOMContentLoaded', () => App.run());
Dersom testserveren kjører kan du overvåke resultatet av kodeendringene i nettleseren.
ES6 enhetstester med Karma og Jasmine
Enhetstester er jo egentlig feigt - men noen ganger er det helt ålreit å ha dem ;-) Oppsett av testmiljø med Karma, Jasmine og PhantomJS er som følger.
- phantomjs
- jasmine
- jasmine-core
- karma
- karma-jasmine
- karma-phantomjs-launcher
- karma-sourcemap-loader
- karma-coverage
- karma-spec-reporter
- karma-webpack
- null-loader
npm install phantomjs jasmine jasmine-core karma karma-jasmine karma-phantomjs-launcher karma-sourcemap-loader karma-coverage karma-spec-reporter karma-webpack null-loader --save-dev
Lag filen ./karma.conf.js
var path = require('path');
module.exports = function(config) {
config.set({
basePath: '',
browsers: ['PhantomJS'],
frameworks: ['jasmine'],
files: [
'./test/test-context.js'
],
plugins: [
'karma-webpack',
'karma-jasmine',
'karma-sourcemap-loader',
'karma-phantomjs-launcher'
],
preprocessors: {
'./test/test-context.js': [ 'webpack', 'sourcemap' ]
},
reporters: ['progress'],
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
webpack: {
devtool: 'eval-source-map',
module: {
loaders: [
{
test: /\.(png|jpg|gif|woff|woff2|css|sass|scss|less|styl)$/,
loader: 'null-loader'
},
{
test: /\.js[x]?$/,
include: [
path.join(__dirname, 'src'),
path.join(__dirname, 'test')
],
loader: 'babel-loader',
query: {
plugins: ['transform-runtime'],
presets: ['es2015', 'stage-0']
}
}
]
},
watch: true
},
webpackServer: {
noInfo: true
},
webpackMiddleware: {
noInfo: true
}
});
};
Lag filen ./test/test-context.js
'use strict';
var context = require.context('.', true, /(-spec\.js$)|(Test\.js$)/);
context.keys().forEach(context);
console.log(context.keys());
Lag filen ./test/js/components/Person-spec.js
'use strict';
import Person from '../../../src/js/components/Person';
describe('Person', () => {
it('should say hello to leif', () => {
let person = new Person('Leif', 'Olsen');
expect(person.name).toBe('Leif Olsen');
});
});
Oppdater "scripts"-blokken i ./package.json
.
"scripts": {
"dev": "./node_modules/.bin/webpack-dev-server --hot --inline --module-bind --progress --color",
"build": "./node_modules/.bin/webpack",
"test": "./node_modules/.bin/karma start"
},
Kjør testene: npm test
Testene kjøres initielt. Deretter kjøres testene så snart Karma oppdager endringer i koden.
Avslutt testovervåkingen med Ctrl+C
TODO: Vurder Mocha, Chai og JsDom i stedet for Karma? Se: From Karma to Mocha, with a taste of jsdom, Webpack testing, A modern React starter pack based on webpack
React
For å komme i gang med React trenger du som et minimum:
npm istall --save react react-dom
npm install --save-dev babel-preset-react
Og babel-loader
i webpack.config.js
blir da:
{
test: /\.js[x]?$/, // Only run `.js` and `.jsx` files through Babel
include: path.join(__dirname, 'src'), // Skip any files outside of your project's `src` directory
loader: 'babel-loader',
query: { // Options to configure babel with
plugins: ['transform-runtime'],
presets: ['es2015', 'stage-0', 'react']
}
},
Nyttige lenker
ES6
- Learn ES2015
- babel-plugin-handbook
- Using ES6 and ES7 in the Browser, with Babel 6 and Webpack
- A Quick Tour Of ES6 (Or, The Bits You’ll Actually Use)
- The Six Things You Need To Know About Babel 6
- The Complete Guide to ES6 with Babel 6
- Get Started with ECMAScript 6
- Exploring es6, free book
- Understanding ECMAScript 6, free book
- ECMAScript 6 Learning
- ECMAScript 6 — New Features: Overview & Comparison
- ECMAScript 6 equivalents in ES5
- ECMAScript 6 Tools
- ECMAScript 6 - git.io/es6features
- Making the most of JavaScript’s “future” today with Babel
- How to Write an Open Source JavaScript Library
- fetch API
- window.fetch polyfill
- isomorphic-fetch - Fetch for node and Browserify. Built on top of GitHub's WHATWG Fetch polyfill.
- core-decorators.js
- Exploring ES2016 Decorators
- 7 Patterns to Refactor JavaScript Applications: Decorators
- Decorators in JavaScript
- lodash-decorators
- javascript-decorators
- Using ES7 Decorators with Babel 6
- Google Developers - Introduction to fetch
- Preparing for ECMAScript 6: New String Methods
- Basic Data structures in ES6
- Understanding ES6 Modules
- The JavaScript Looping Evolution
- Cookbook (es6)
- ES6 - Sean Saranga Amarasinghe
- Understanding ECMAScript 6 arrow functions
- ES6 arrow functions, syntax and lexical scoping
- ES6 in the Wild
- JavaScript Design Patterns in ES 2015
- Using the ES6 transpiler Babel on Node.js
- Finitely Iterating Infinite Data With ES6 Generators
- JavaScript Promises
- Easy asynchrony with ES6
- That's so fetch!
- Tasks, microtasks, queues and schedules
- HTML5 Local Storage and Session Storage
- Storing Data on The Client with LocalStorage
- The Basics Of ES6 Generators
- Diving Deeper With ES6 Generators
- ES6 Promises in Depth
- ES 7 decorators to reduce boilerplate when creating custom HTML elements.
- HTML templating with ES6 template strings
- es6-template-demo - working demo code from http://www.2ality.com/2015/01/template-strings-html.html
- Getting Literal With ES6 Template Strings
- The Genius of Template Strings in ES6
- ES6 In Depth: Template strings
- HTML Exports
- SystemJS
- How to Implement HTML5 Local Storage
- JavaScript Fetch API in action
- Creating an ES6 DOM Library
- Digging into the modern JavaScript - ES6
- Start your own JavaScript library using webpack and ES6
- Real Life ES6 - Arrow Functions
- i18n with tagged template strings in ECMAScript 6
- You Don't Know JS (book series)
- promise-cookbook
- promise-cookbook
- Web Components, by Bill Stavroulakis
- Riot.js - A React-like user interface micro-library
- Enumify - A JavaScript library for enums. To be used by transpiled ES6
- Future JavaScript
- Vanilla JavaScript TodoMVC Example
- Vanilla ES6 (ES2015) • TodoMVC
- Mozilla - ES6 In Depth Articles
- ES6 One Liners to Show Off
- Lightweight ES6 Features That Pack A Punch
- Staying Sane With Asynchronous Programming: Promises and Generators
events, EventEmitter, PubSub
- Implementing EventEmitter in ES6
- Pub Sub with Event Emitter
- Node.js EventEmitter Tutorial
- [Becoming fully reactive: an in-depth explanation of Mobservable]
RxJS
- ReactiveX - The Observer pattern done right
- RxJS 5, beta - Compliant with the EcmaScript Observable Spec
- The Reactive Extensions for JavaScript (RxJS) 4.0
- ReactiveX tutorials
- RxJS v4.0 - an on-line book by Dennis Stoyanov
- Fluorine - State Accumulation from a single stream of actions
- The introduction to Reactive Programming you've been missing
- Functional Programming in Javascript
- RxJS Evolved
- What Is RxJS?
- RxJS 5
- HOW TO DEBUG RXJS CODE
- Create a simple toggle button using reactive programming
- HOW TO DEBUG RXJS CODE
- The introduction to Reactive Programming you've been missing
- RxJS Observables vs Promises
- RxJS tutorials
- Rxmq.js - JavaScript pub/sub library based on RxJS
- Flyd - The modular, KISS, functional reactive programming library for JavaScript.
- Cycle.js - A functional and reactive JavaScript framework for cleaner code
- ReactiveX - The Observer pattern done right
Webpack
- What is webpack
- Webpack configuration
- WEBPACK 101: AN INTRODUCTION TO WEBPACK
- Webpack and Babel – ES6 & ES7 on the front end
- Tutorial – write in ES6 and Sass on the front end with Webpack and Babel
- Beginner’s guide to Webpack
- Introduction to Webpack with practical examples
- Setting Up a Front End Development Environment
- Developing with Webpack
- webpack-howto
- Creating a workflow with WebPack
- advanced-webpack
- webpack-demos
- Webpack Made Simple: Building ES6 & LESS with autorefresh
- pushState With Webpack-dev-server
- How to store assets separately with Webpack
- How to configure font file output directory from font-awesome-webpack in webpack?
- Introduction to Webpack
- Advanced WebPack Part 1 - The CommonsChunk Plugin
- webpack-babel-boilerplate
- Start your own JavaScript library using webpack and ES6
- babel-npm-boilerplate
CSS/SASS
- Smarter CSS builds with Webpack
- Styling React Components In Sass
- Writing Happy Stylesheets with Webpack
- Tutorial – write in ES6 and Sass on the front end with Webpack and Babel
- Webpack CSS Example
- Faster SASS builds with Webpack
- Roboto fontface
- Google Fonts Files
- font-roboto-local
- font-awesome-webpack
- Myth - CSS the way it was imagined
- Introduction to Myth – CSS Preprocessor
- Modernizr - Respond to your user’s browser features.
- modernizr-loader for webpack
- CSS4 variables in SASS - HOUSTON, WE WILL PROBABLY END UP TOTALLY HAVING A PROBLEM
- Why I'm Excited About Native CSS Variables
- A Polyfill for CSS3 calc()
- Writing a CSS Parser in JavaScript
- css.js - A lightweight, battle tested, fast, css parser in JavaScript
- matchMedia() polyfill - test whether a CSS media type or media query applies
- Respond.js - A fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)
- Animate.css - A cross-browser library of CSS animations.
- CSS next - Use tomorrow's CSS syntax, today.
- COLORS - A nicer color palette for the web.
- How to use responsive breakpoint analytics to measure design performance
Lint
Test
- Writing Jasmine Unit Tests In ES6
- Webpack testing
- Testing with webpack and Mocha
- From Karma to Mocha, with a taste of jsdom
- Automated Node.js Testing with Jasmine
- How to easily test React components with Karma and Webpack
- How to test React components using Karma and webpack
- Node.js and ES6 Instead of Java – A War Story
- js-tests-pro
- webpack-mocha-demo
- Universal (isomorphic) boilerplate written in ES2015 for Node and the browser.
- A modern React starter pack based on webpack
- From Karma to Mocha, with a taste of jsdom
- Testing with webpack and Mocha
- Testing in ES6 with Mocha and Babel 6
- Setting up Unit Testing with Mocha and Chai
- Adding ES6 Support to Tests using Mocha and Babel
- Testing React on Jsdom
- Sinon Spies vs. Stubs
- testing-with-karma-webpack
- Tutorial – write in ES6 and Sass on the front end with Webpack and Babel
- JavaScript Design Patterns in ES 2015
NoeJS, Express
- Running scripts with npm
- Node.js Tutorials
- NODESCHOOL
- Howto Node
- webpack-express-boilerplate
- Getting Started with Express - Up and Running
- react-express-babel6
- Using ES6/ES2015 in a Node.JS and Express
- Dropbox Express with ECMAScript 6+
- Express & ES6 REST API Boilerplate
- nodemon
- Build a RESTful API Using Node and Express 4
- Building a Node.js REST API with Express
- Node.js - Express Framework
- ExpressJs Router Tutorial
- Best Practices for Node.js Development
- Create a character voting app using React, Node.js, MongoDB and Socket.IO
- Universal (isomorphic) boilerplate written in ES2015 for Node and the browser.
- Example Node Server w/ Babel
- NodeJS Express ES6 Hello world
- Best Practices for Node.js Development
- Expressive ES6 features that shine in Node.js 4.0
- Configure your Node.js Applications
- Architecting a Secure RESTful Node.js app
- Passport - Simple, unobtrusive authentication for Node.js
- express-validator - An express.js middleware for node-validator.
- NodeJS Tutorial Playlist
- Getting Started with Node.js on Heroku
- How I Structure RESTful APIs using Express 4.
- easy-express-controllers
- NodeJS and ES6
Videos
- Decorators in JavaScript
- What Is RxJS?
- RxJS 5
- Promise to not use Promises – ES7 Observables by Brian Holt
- NodeJS and ES6
- Async JavaScript with Promises
Etc
- A modern React starter pack based on webpack
- react-webpack-cookbook
- Frontend development with webpack, json-server, tape and NPM — Pt. 1
- Nock
- Mocking API Requests in Node tests
- JSON Server
- Creating Demo APIs with json-server
- Node EasyMock Server
- Setup Webpack on an ES6 React app with SASS
- How to easily test React components with Karma and Webpack
- How to test React components using Karma and webpack
- Redux
- Aurelia - next gen JavaScript client framework
- rivets.js - Lightweight and powerful data binding + templating solution for building modern web applications.
- JavaScript Air - The live broadcast podcast all about JavaScript
- updtr - Update outdated npm modules with zero pain
- javascriptkicks
- router.js
- hyperagent.js - A HAL client for JavaScript http://weluse.github.io/hyperagent
- HTMLBars
- DOMtastic - Small, fast, and modular DOM & Event library for modern browsers
- ES6-DOM
- stevia: Natural sweetener for Javascript Objects
- html-template-tag
- smooth-scroll
- How to forget about jQuery and start using native JavaScript APIs
- You Don't Need jQuery!
- Native JavaScript Equivalents of jQuery Methods: the DOM and Forms
- Bliss: Want to use Vanilla JS but find native APIs a bit unwieldy? Bliss is for you.
- Bliss: Heavenly JavaScript
- Dom Diff
- Mithril: A Javascript Framework for Building Brilliant Applications
- Skills Matter Logo
- microscopejs
- Lodash: 10 Javascript Utility Functions That You Should Probably Stop Rewriting
- html-template-to-dom
- Benjamin De Cock - Gists
- ES.next showcase - Showcasing real-world usage of ECMAScript 6 (the next JavaScript version) features
- bling.js
- requestAnimationFrame API: now with sub-millisecond precision
- requestAnimationFrame for Smart Animating
- request-frame
- HTML5 2D game development: Graphics and animation, rAf polyfill
- Using requestAnimationFrame
- requestanimationframe-fix.js
- smooth-scroll
- micro-tween
- tween.js: JavaScript tweening engine for easy animations, incorporating optimised Robert Penner's equations.
- Automatos: A CSS Animation library
- request-animation-frame-shim
- Animating Without jQuery
- Velocity.js
- paulcpederson/scroll.js
- MutationObserver API
- Detect, Undo And Redo DOM Changes With Mutation Observers
- Using Mutation Observers to Watch for Element Availability
- polyfill-custom-event, es6
- Cross-browser CustomEvent constructor, polyfill
- How to Create Custom Events in JavaScript
- JavaScript CustomEvent
- Capture and report JavaScript errors with window.onerror
- Lose the jQuery Bloat — DOM Manipulation with NodeList.js
- NodeList.js
- Stop Writing Slow Javascript
- Creating Cross Browser HTML5 Forms Now, Using modernizr, webforms2 and html5Forms
- Cross Browser HTML5 Progress Bars In Depth
- dialog-polyfill.js is a polyfill for <dialog>
- dialog element demo
- HTML5 Dialog tag with polyfill
- ShowModalDialog Polyfill
- Native Modal Windows in HTML5: Using the dialog Element
- nwxforms
- The H5F library, emulate the HTML5 forms chapter
- H5F: a JavaScript library that allows you to use the HTML5 Forms
- Web Experience Toolkit, Collaborative open source project led by the Government of Canada
- Web Experience Toolkit: polyfills
- WEBSHIMS LIB: POLYFILL ONLY THE INCAPABLE BROWSERS
- details polyfill
- Making A Complete Polyfill For The HTML5 Details Element
- Feature Detection and Styling For The HTML5 details Element
- CSS Script: Simple Free JavaScript / CSS / CSS3 / HTML5 codes to make your life easier.
- CSS Script: Accordion
- 18 Best HTML5 CSS3 Accordion Tabs and Menus
- Fancy FAQ page using CSS3 only