Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ES6 de plein front avec Browserify

ES6 de plein front avec Browserify

Why and how introduce ES6 and Browserify in your existing codebase.

Code exemples can be found on GitHub : https://github.com/farnoux/web2day-2015-browserify-es6

Presented in the context of the 2015 Web2Day event, in the iAdvize HQ, in beautiful Nantes, France, by @farnoux.

Avatar for Fred Arnoux

Fred Arnoux

June 05, 2015

Other Decks in Programming

Transcript

  1. how modularity used to be (function(global) { global.salut = function(name)

    { console.log(‘salut ’ + name); }; })(this);
  2. manual dependency management (inclusion order matters) <script src="js/salut.js"></script> <script src="js/michel.js"></script>

    (function(global) { global.michel = function() { global.salut(‘Michel’); }; })(this);
  3. awesome npm catalog var _ = require(‘lodash’); // package.json {

    “dependencies”: { “lodash”: “1.0.0” } }
  4. bundle up all your modules in one file // gulpfile

    browserify(‘./michel.js’) .bundle() <script src="bundle.js"></script>
  5. default parameters function salut(name) { name = name || ‘Michel’;

    console.log(‘salut ’ + name); } function salut(name = ‘Michel’) { console.log(‘salut ’ + name); } ES5 ES6
  6. class function Man {} Man.prototype.salut = function() { console.log(‘salut’); }

    class Man { constructor() {} salut() { console.log(‘salut’); } } ES5 ES6