34
Front-end tools vs. Pain Bower, Grunt, Gulp, Webpack,Yeoman, …

Front-end tools

Embed Size (px)

Citation preview

Page 1: Front-end tools

Front-end tools vs.

Pain

Bower, Grunt, Gulp, Webpack, Yeoman, …

Page 2: Front-end tools

Gleb Vinnikov CTO/PM Full Stack JS Developer oDesk, YuktiDev, PortaOne [email protected]

Page 3: Front-end tools

Duties

� Ext. lib �  Include lib to html � Versioning � Minification � Bundle package �  Sprites � Deploy to servers � …

Page 4: Front-end tools

https://nodejs.org

� Chrome's V8 runtime. � Node.js uses an event-driven � non-blocking I/O model

https://iojs.org

Page 5: Front-end tools

https://www.npmjs.com/

Page 6: Front-end tools

Bower

A package manager for the web

http://bower.io/

Page 7: Front-end tools

Bower

A package manager for the web

http://bower.io/

� 18K Packages

Page 8: Front-end tools

Bower

A package manager for the web

http://bower.io/

� 18K Packages �  Search/Install/Update/Delete

Page 9: Front-end tools

Bower

A package manager for the web

http://bower.io/

� 18K Packages �  Search/Install/Update/Delete �  bower install git://github.com/package.git

Page 10: Front-end tools

Bower

A package manager for the web

http://bower.io/

� 18K Packages �  Search/Install/Update/Delete �  bower install git://github.com/package.git �  bower install http://example.com/script.js

Page 11: Front-end tools

Grunt The JavaScript Task Runner 4400+

http://gruntjs.com/

Gulp

http://gulpjs.com/

Automate and enhance your workflow 1400+

Page 12: Front-end tools

module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { options: { banner: '/*! <%= pkg.name %> */\n' }, build: { src: 'src/<%= pkg.name %>.js', dest: 'build/<%= pkg.name %>.min.js' } } }); // Load the plugin that provides the "uglify" task. grunt.loadNpmTasks('grunt-contrib-uglify'); // Default task(s). grunt.registerTask('default', ['uglify']); };

Page 13: Front-end tools

var gulp = require('gulp'); gulp.task('one', function(cb) { gulp.src('client/**/*.js') .pipe(minify()) .pipe(gulp.dest('build')); }); gulp.task('two’, function() { }); gulp.task('default', ['one', 'two']);

Page 14: Front-end tools

module.exports = function (grunt) { // Configure grunt grunt.initConfig({ sprite:{ all: { src: 'path/to/your/sprites/*.png', dest: 'destination/of/spritesheet.png', destCss: 'destination/of/sprites.css' } } }); // Load in `grunt-spritesmith` grunt.loadNpmTasks('grunt-spritesmith'); };

npm install grunt-spritesmith

Page 15: Front-end tools

watch: { css: { files: '**/*.sass', tasks: ['sass'], options: { livereload: true, } } }

npm install grunt-contrib-watch

Page 16: Front-end tools

grunt.initConfig({ uglify: { options: { mangle: false }, my_target: { files: { 'dest/output.min.js': ['src/input.js'] } } } });

npm install grunt-contrib-uglify

Page 17: Front-end tools

grunt.initConfig({ jshint: { all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'] } });

npm install grunt-contrib-jshint

Page 18: Front-end tools

inject: { single: { scriptSrc: 'build/devscript.js', files: { 'dist/index.html': 'src/index.html' } } }

npm install grunt-inject

Page 19: Front-end tools

'sftp-deploy': { build: { auth: { host: 'server.com', port: 22, authKey: 'key1' }, cache: 'sftpCache.json', src: '/path/to/source/folder', dest: '/path/to/destination/folder', exclusions: ['/path/to/source/folder/**/.DS_Store', 'dist/tmp'], concurrency: 4, progress: true } }

npm install grunt-sftp-deploy

Page 20: Front-end tools

imagemin: { // Task static: { // Target options: { // Target options optimizationLevel: 3, }, files: { // Dictionary of files 'dist/img.png': 'src/img.png', // 'destination': 'source' 'dist/img.jpg': 'src/img.jpg', 'dist/img.gif': 'src/img.gif' } }, } }

npm install grunt-contrib-imagemin

Page 21: Front-end tools

Webpack

http://webpack.github.io/

� Plugins

Page 22: Front-end tools

Webpack

http://webpack.github.io/

� Plugins � Loaders

Page 23: Front-end tools

Webpack

http://webpack.github.io/

� Plugins � Loaders � Code Splitting into chunks

Page 24: Front-end tools

Webpack

http://webpack.github.io/

� Plugins � Loaders � Code Splitting into chunks � Optimization

Page 25: Front-end tools

Webpack

http://webpack.github.io/

� Plugins � Loaders � Code Splitting into chunks � Optimization � Hot Module Replacement

Page 26: Front-end tools

Yeoman The Web's scaffolding tool for modern webapps

http://yeoman.io/

� 1100+ generators

Page 27: Front-end tools

Yeoman The Web's scaffolding tool for modern webapps

http://yeoman.io/

� 1100+ generators �  Sub-generators

Page 28: Front-end tools

Yeoman The Web's scaffolding tool for modern webapps

http://yeoman.io/

� 1100+ generators �  Sub-generators � Creating a generator

Page 29: Front-end tools

PhantomJS PhantomJS is a headless browser

http://phantomjs.org/

�  JavaScriptCore with JIT compiler

Page 30: Front-end tools

PhantomJS PhantomJS is a headless browser

http://phantomjs.org/

�  JavaScriptCore with JIT compiler � Headless web testing

Page 31: Front-end tools

PhantomJS PhantomJS is a headless browser

http://phantomjs.org/

�  JavaScriptCore with JIT compiler � Headless web testing � Page automation

Page 32: Front-end tools

PhantomJS PhantomJS is a headless browser

http://phantomjs.org/

�  JavaScriptCore with JIT compiler � Headless web testing � Page automation � Network monitoring

Page 33: Front-end tools

Questions ?

Page 34: Front-end tools

Thanks!

Gleb Vinnikov [email protected]