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

Front-End workflows

Cesar
October 03, 2015

Front-End workflows

Cesar

October 03, 2015
Tweet

More Decks by Cesar

Other Decks in Technology

Transcript

  1. F R O N T- E N D W O

    R K F L O W S C E S A R C H E N
  2. O u r t o o l s l a

    n d s c a p e i s g e t t i n g m o re c o m p l e x .
  3. A S Y O U K N O W… “Time”

    is a key factor in staying productive.
  4. D E V E L O P Watch Sass /

    Less / Stylus Watch ES6 / CoffeeScript Watch HTML / Jade / Haml LiveReload JS / CSS Linting
  5. B U I L D Code linting Running unit tests

    Compile everything Minify & concatenate Generate images / icons Optimize performance HTTP Server Deployment
  6. A U T O M A T E T H

    I S W O R K F L O W F O R A L L T Y P E S O F P R O J E C T
  7. N O D E PA C K A G E

    S M A N A G E R
  8. I N S TA L L M O D U

    L E S $ npm install module-name $ npm install —save module-name
  9. PA C K A G E . J S O

    N { “name”: “project-name”, “version”: “0.0.0”, “dependencies: { “gulp”: “^3.9.0”, “webpack”: “^1.11.0” } }
  10. G U L P • A build system • A

    task runner • A workflow automator
  11. W H Y G U L P ? • Smaller,

    more efficient plug-ins • Built-in file watching functionality • JavaScript Configuration files • Streams
  12. G U L P F I L E . J

    S var gulp = require(‘gulp’); gulp.task(‘task-name’, function() { … }); gulp.task(‘default’, [‘task-name’]);
  13. G U L P F I L E . J

    S $ gulp task-name
  14. S O U R C E gulp.task(‘task-name’, function() { return

    gulp.src(‘./src/js/*.js’) .pipe(…); });
  15. D E S T I N AT I O N

    gulp.task(‘task-name’, function() { return gulp.src(‘./src/js/*.js’) .pipe(…) .pipe(gulp.dest(‘./build’); });
  16. D E S T I N AT I O N

    gulp.task(‘task-name’, function() { gulp.watch(‘./src/js/**’, [‘build-task’]); });
  17. U S E F U L P L U G

    I N S F O R G U L P gulp-concat gulp-uglify gulp-rename gulp-util browser-sync
  18. P L U G I N S var concat =

    require(‘gulp-concat’); var rename = require(‘gulp-rename’); gulp.task(‘task-name’, function() { return gulp.src(‘./src/js/*.js’) .pipe(concat(‘app.js’)) .pipe(rename({ suffix: ‘.min’} .pipe(gulp.dest(‘./build’); });
  19. <script src=“jquery.min.js></script> <script src=“angular.min.js”</script> <script src=“bootstrap.min.js”</script> <script src=“slick.min.js”</script> <script src=“angular-slick.js”</script>

    <script src=“…”</script> <script src=“…”</script> <script src=“…”</script> <script src=“…”</script> <script src=“…”</script> <script src=“app.js”></script>
  20. C O N F I G U R AT I

    O N C L I & w e b p a c k . c o n f i g . j s
  21. H O T M O D U L E R

    E P L A C E M E N T http://webpack.github.io/docs/hot-module-replacement-with-webpack.html
  22. H O T M O D U L E R

    E P L A C E M E N T Entry webpack-dev-server/client?http://localhost:3000 webpack/hot/only-dev-server Plugins new webpack.HotModuleReplacementPlugin()
  23. W E B PA C K - D E V-

    S E R V E R
  24. M O R E … • NPM • https://www.npmjs.com/ •

    Gulp • http://gulpjs.com/ • https://scotch.io/tutorials/automate-your-tasks-easily-with- gulp-js • http://leveluptuts.com/tutorials/learning-gulp • Webpack • https://webpack.github.io/ • https://github.com/petehunt/webpack-howto