Successfully reported this slideshow.

Lightning Talk: Making JS better with Browserify

0

Share

Upcoming SlideShare
05 Web Services
05 Web Services
Loading in …3
×
1 of 13
1 of 13

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

Lightning Talk: Making JS better with Browserify

  1. 1. brows·er·if·y Javascript module management for mere mortals
  2. 2. My Application jQuery underscore Application Code Library Code
  3. 3. My Application jQuery underscore Application Code Library Code Linker
  4. 4. My Application jQuery underscore Application Code Library Code global variables
  5. 5. Module management with globals Modules individually included on the page Share a global namespace Inclusion order must be manually calculated
  6. 6. –browserify.org “Browserify lets you require('modules') in the browser by bundling up all of your dependencies.”
  7. 7. Module management with browserify Modules are scoped in their own namespace Uses CommonJS standard interface Dependencies defined using require function Modules are defined by assigning an object to module.exports Exactly like node.js
  8. 8. var $ = require(‘jquery’); $(‘body’).html(“Browserify saves the day”); main.js
  9. 9. ~/$ npm install jquery --save ~/$ browserify main.js -o bundle.js Build process
  10. 10. var MyModel = function() { … } module.exports = MyModel; models/MyModel.js
  11. 11. var $ = require(‘jquery’), _ = require(‘underscore’), MyModel = require(‘../models/MyModel’); main.js
  12. 12. Where to from here? Detailed documentation: http://bit.ly/1kbozFB grunt-browserify: wrapper for integration into Grunt build with other tools, like uglify. exorcist: extract source maps for browsers. Very useful, terrible name. watchify: CLI file watcher for performing automatic builds during development.
  13. 13. Any questions?

×