SlideShare a Scribd company logo
Web development
tools
@_francois06
@hugomallet
@53JSdevDecember 2016
University of Nice Sophia Antipolis
{ starter pack }
Who we are
And we love gif !
#WhatDoWeNeed?
Web development tools
FAST
D.R.Y.
FLEXIBLE
Improve development
Localhost server
LiveReload
Package manager
Module bundler
SASS with sourcemap
...
to focus on the features of your own app
Prepare for deployment
Concatenate JS, CSS
Minify CSS, HTML, JS, images
Copy all the files in dist folder
Package your app for differents platforms
(apk, ipa, exe, html)
Must be done in one command line
Web development tools { starter pack }
Web development tools { starter pack }
> npm init
> npm install commander
> npm test
> npm publish
#!/usr/bin/env node
const program = require('commander');
const pkg = require('./package');
program.version(pkg.version)
.option('-n, --name [value]', 'Name')
.parse(process.argv);
console.log('Hello ' + program.name);
Automate and
enhance your
workflow
npm install -g gulp-cli
npm init
npm install gulp --save-dev
Task gulp
const gulp = require('gulp');
gulp.task('build', function() {
// do something...
});
gulp.task('default', 'build', function() {
console.log('default task');
});
# gulpfile.js
> gulp
Starting 'build'
Finished 'build'
Starting 'default'
Finished 'default'
> gulp build
Starting 'build'
Finished 'build'
Terminal
streams
gulp
.src('scripts/*.js')
.pipe(applySomething())
.pipe(gulp.dest('dist/scripts'));
gulp.task('sass', function() {
return gulp.src('app/styles/main.scss')
.pipe($.sourcemaps.init())
.pipe($.sass({
outputStyle: 'nested', // libsass doesn't support expanded yet
precision: 10,
includePaths: ['.'],
onError: console.error.bind(console, 'Sass error:')
}).on('error',$.sass.logError))
.pipe($.if(production,
$.replace('node_modules/bootstrap-sass/assets/fonts/bootstrap', 'fonts')))
.pipe($.autoprefixer({
browsers: ['last 1 version']
}))
.pipe($.if(production, $.sourcemaps.write('.', {
includeContent: false,
sourceRoot: './'
})))
.pipe(gulp.dest('dist/styles'));
});
WATCH & RELOAD
1. Start a server
2. Watch files
3. Reload files in browser
const connect = require('connect');
const connectLivereload =
require('connect-livereload');
const gulp = require('gulp');
const serveStatic = require('serve-static');
gulp.task('serve', function() {
var app = connect()
.use(connectLivereload({
port: 35729
}))
.use(serveStatic('app'))
.listen(9000);
});
const livereload = require('gulp-livereload');
gulp.task('watch', ['serve'], function() { livereload.listen();
gulp.watch([
'app/scripts/**/*.js',
'app/images/**/*',
'.tmp/styles/*'
]).on('change', livereload.changed);
gulp.watch(['styles/**/*.{css,scss}'], ['sass']);
});
gulp.task('default', ['watch']);
Serve files Watch files and reload
SCSS !
$color: blue;
li {
// menu links
a {
background: $color;
}
}
CSS
# dist/main.css
li a {
background: blue;
}
const gulp = require('gulp');
const sass = require('gulp-sass');
gulp.task('sass', function() {
return gulp.src('app/styles/main.scss')
.pipe(sass())
.pipe(gulp.dest('dist/styles'));
});
BE LAZY
“I choose a lazy person to do a hard job.
Because a lazy person will find an easy way
to do it.”
― Bill Gates
Be lazy : example
const gulp = require('gulp');
const sass = require('gulp-sass');
const debug = require('gulp-debug');
gulp.task('sass', function() {
return gulp.src('app/styles/main.scss')
.pipe(debug())
.pipe(sass())
.pipe(gulp.dest('dist/styles'));
});
const gulp = require('gulp');
const $ = require('gulp-load-plugins')(),
gulp.task('sass', function() {
return gulp.src('app/styles/main.scss')
.pipe($.debug())
.pipe($.sass())
.pipe(gulp.dest('dist/styles'));
});
npm i -D gulp-load-plugins
Debug
gulp-plumber
Prevent pipe breaking caused by errors
from gulp plugins
https://gist.github.com/floatdrop/8269868
gulp-debug
Debug vinyl file streams to see what files
are run through your gulp pipeline
Let’s require('modules')
in the browser
Require ?
# lib/module.js
exports.multiply = function multiply(a, b) {
return a * b;
}
exports.add = function add(a, b) {
return a + b;
}
# tests/module.js
const assert = require('assert');
const mymath = require('../lib/module');
const multiply = mymath.multiply;
describe('mymath', () => {
describe('#multiply(a, b)', () => {
it('should return 6 with 2 and 3', () => {
assert.equal(6, multiply(2, 3));
assert.equal(6, multiply(3, 2));
});
});
});
Browserify : require in the browser !
> npm install -g browserify
> npm install --save jquery
> browserify main.js -o dist/bundle.js
const $ = require('jquery');
const mult = require('./lib/module').multiply;
let $a = $('.num-a');
let $b = $('.num-b');
$('button').on('click', function onClick(event) {
mult($a.val(), $b.val());
});
Terminal # main.js
be prepared for
ES6 Modules
export function multiply(a, b) { … }
import { multiply } from './lib/module'
+≃
ESLint
Share style guides !
Avoid mistakes !
# .eslintrc
/*
* Extending the code style
* of the devs at Airbnb
*/
{
'extends': 'eslint-config-airbnb'
}
{ SOURCEMAPS }
> npm publish
This is just an overview ...
Build your own
gulpfile.js
adapted to your tools and
methods !
A sample we made for you :
https://github.com/53js/simple-webapp/
And now you need to
choose a good JavaScript
framework
http://todomvc.com/
Thank you !
https://www.53js.fr
Last important thing

More Related Content

PDF
Gulp: Your Build Process Will Thank You
PPTX
Introduction to Gulp
PPTX
Gulp: Task Runner
PPTX
Automated Development Workflow with Gulp
PPTX
JavaScript Task Runners - Gulp & Grunt
PDF
Intro to Gulp
ODP
GulpJs - An Introduction
Gulp: Your Build Process Will Thank You
Introduction to Gulp
Gulp: Task Runner
Automated Development Workflow with Gulp
JavaScript Task Runners - Gulp & Grunt
Intro to Gulp
GulpJs - An Introduction

What's hot (19)

PPTX
JavaScript code academy - introduction
PDF
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
PDF
Angular workflow with gulp.js
PDF
Automating your workflow with Gulp.js
PDF
Gulp - the streaming build system
PDF
Improving your workflow with gulp
PDF
Frontend JS workflow - Gulp 4 and the like
PDF
Gulp - The Streaming Build System
PDF
Screenshot as a service
PDF
Automating Large Applications on Modular and Structured Form with Gulp
DOCX
Manual google page speed
PPTX
Web development-workflow
PPTX
Writing data analysis pipeline as ruby gem
ZIP
Practical project automation
PDF
MLBlock
PDF
Monitoring at a SAAS Startup: Tradeoffs and Tools
PPTX
Toolbox of a Ruby Team
PDF
How to integrate front end tool via gruntjs
PDF
The Secrets of The FullStack Ninja - Part A - Session I
JavaScript code academy - introduction
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
Angular workflow with gulp.js
Automating your workflow with Gulp.js
Gulp - the streaming build system
Improving your workflow with gulp
Frontend JS workflow - Gulp 4 and the like
Gulp - The Streaming Build System
Screenshot as a service
Automating Large Applications on Modular and Structured Form with Gulp
Manual google page speed
Web development-workflow
Writing data analysis pipeline as ruby gem
Practical project automation
MLBlock
Monitoring at a SAAS Startup: Tradeoffs and Tools
Toolbox of a Ruby Team
How to integrate front end tool via gruntjs
The Secrets of The FullStack Ninja - Part A - Session I
Ad

Viewers also liked (7)

PDF
Get Pumped for the HTML 5 Gamepad API
PDF
1st npm
PDF
Designing Modules for the Browser and Node with Browserify
PDF
Lightning Talk: Making JS better with Browserify
PDF
Browserify
PDF
JavaScript Dependencies, Modules & Browserify
PDF
Building testable chrome extensions
Get Pumped for the HTML 5 Gamepad API
1st npm
Designing Modules for the Browser and Node with Browserify
Lightning Talk: Making JS better with Browserify
Browserify
JavaScript Dependencies, Modules & Browserify
Building testable chrome extensions
Ad

Similar to Web development tools { starter pack } (20)

PDF
Quest for the Perfect Workflow for McrFRED
PDF
Grunt & Front-end Workflow
PDF
Getting started with gulpjs
PDF
Npm scripts
PDF
Hitchhiker's guide to the front end development
PDF
May The Nodejs Be With You
PDF
Get Grulping with JavaScript Task Runners (Matt Gifford)
PDF
Plumbin Pipelines - A Gulp.js workshop
PDF
Javascript is your (Auto)mate
PPTX
2015 - Basta! 2015, DE: JavaScript und build
PDF
Automating Front-End Workflow
PDF
Devenez le plus heureux des Front-end avec Gulp.js
PDF
G*なクラウド ~雲のかなたに~
PDF
Forget Grunt and Gulp! Webpack and NPM rule them all!
PDF
JLPDevs - Optimization Tooling for Modern Web App Development
PDF
Workflow para desenvolvimento Web & Mobile usando grunt.js
PDF
Workflow automation for Front-end web applications
PPTX
Gulp and bower Implementation
PPTX
PSGI and Plack from first principles
PDF
Painless Deployment with Capistrano
Quest for the Perfect Workflow for McrFRED
Grunt & Front-end Workflow
Getting started with gulpjs
Npm scripts
Hitchhiker's guide to the front end development
May The Nodejs Be With You
Get Grulping with JavaScript Task Runners (Matt Gifford)
Plumbin Pipelines - A Gulp.js workshop
Javascript is your (Auto)mate
2015 - Basta! 2015, DE: JavaScript und build
Automating Front-End Workflow
Devenez le plus heureux des Front-end avec Gulp.js
G*なクラウド ~雲のかなたに~
Forget Grunt and Gulp! Webpack and NPM rule them all!
JLPDevs - Optimization Tooling for Modern Web App Development
Workflow para desenvolvimento Web & Mobile usando grunt.js
Workflow automation for Front-end web applications
Gulp and bower Implementation
PSGI and Plack from first principles
Painless Deployment with Capistrano

Recently uploaded (20)

PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
Introduction to Information and Communication Technology
PPTX
Digital Literacy And Online Safety on internet
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
artificial intelligence overview of it and more
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPT
tcp ip networks nd ip layering assotred slides
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
Internet___Basics___Styled_ presentation
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
522797556-Unit-2-Temperature-measurement-1-1.pptx
presentation_pfe-universite-molay-seltan.pptx
Introduction to Information and Communication Technology
Digital Literacy And Online Safety on internet
Job_Card_System_Styled_lorem_ipsum_.pptx
Design_with_Watersergyerge45hrbgre4top (1).ppt
artificial intelligence overview of it and more
Slides PPTX World Game (s) Eco Economic Epochs.pptx
tcp ip networks nd ip layering assotred slides
SAP Ariba Sourcing PPT for learning material
The New Creative Director: How AI Tools for Social Media Content Creation Are...
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Internet___Basics___Styled_ presentation
Introuction about ICD -10 and ICD-11 PPT.pptx
Triggering QUIC, presented by Geoff Huston at IETF 123
QR Codes Qr codecodecodecodecocodedecodecode
Cloud-Scale Log Monitoring _ Datadog.pdf
Decoding a Decade: 10 Years of Applied CTI Discipline

Web development tools { starter pack }

  • 3. And we love gif !
  • 6. Improve development Localhost server LiveReload Package manager Module bundler SASS with sourcemap ... to focus on the features of your own app
  • 7. Prepare for deployment Concatenate JS, CSS Minify CSS, HTML, JS, images Copy all the files in dist folder Package your app for differents platforms (apk, ipa, exe, html) Must be done in one command line
  • 10. > npm init > npm install commander > npm test > npm publish #!/usr/bin/env node const program = require('commander'); const pkg = require('./package'); program.version(pkg.version) .option('-n, --name [value]', 'Name') .parse(process.argv); console.log('Hello ' + program.name);
  • 12. npm install -g gulp-cli npm init npm install gulp --save-dev
  • 13. Task gulp const gulp = require('gulp'); gulp.task('build', function() { // do something... }); gulp.task('default', 'build', function() { console.log('default task'); }); # gulpfile.js > gulp Starting 'build' Finished 'build' Starting 'default' Finished 'default' > gulp build Starting 'build' Finished 'build' Terminal
  • 15. gulp.task('sass', function() { return gulp.src('app/styles/main.scss') .pipe($.sourcemaps.init()) .pipe($.sass({ outputStyle: 'nested', // libsass doesn't support expanded yet precision: 10, includePaths: ['.'], onError: console.error.bind(console, 'Sass error:') }).on('error',$.sass.logError)) .pipe($.if(production, $.replace('node_modules/bootstrap-sass/assets/fonts/bootstrap', 'fonts'))) .pipe($.autoprefixer({ browsers: ['last 1 version'] })) .pipe($.if(production, $.sourcemaps.write('.', { includeContent: false, sourceRoot: './' }))) .pipe(gulp.dest('dist/styles')); });
  • 16. WATCH & RELOAD 1. Start a server 2. Watch files 3. Reload files in browser
  • 17. const connect = require('connect'); const connectLivereload = require('connect-livereload'); const gulp = require('gulp'); const serveStatic = require('serve-static'); gulp.task('serve', function() { var app = connect() .use(connectLivereload({ port: 35729 })) .use(serveStatic('app')) .listen(9000); }); const livereload = require('gulp-livereload'); gulp.task('watch', ['serve'], function() { livereload.listen(); gulp.watch([ 'app/scripts/**/*.js', 'app/images/**/*', '.tmp/styles/*' ]).on('change', livereload.changed); gulp.watch(['styles/**/*.{css,scss}'], ['sass']); }); gulp.task('default', ['watch']); Serve files Watch files and reload
  • 18. SCSS ! $color: blue; li { // menu links a { background: $color; } }
  • 19. CSS # dist/main.css li a { background: blue; } const gulp = require('gulp'); const sass = require('gulp-sass'); gulp.task('sass', function() { return gulp.src('app/styles/main.scss') .pipe(sass()) .pipe(gulp.dest('dist/styles')); });
  • 20. BE LAZY “I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.” ― Bill Gates
  • 21. Be lazy : example const gulp = require('gulp'); const sass = require('gulp-sass'); const debug = require('gulp-debug'); gulp.task('sass', function() { return gulp.src('app/styles/main.scss') .pipe(debug()) .pipe(sass()) .pipe(gulp.dest('dist/styles')); }); const gulp = require('gulp'); const $ = require('gulp-load-plugins')(), gulp.task('sass', function() { return gulp.src('app/styles/main.scss') .pipe($.debug()) .pipe($.sass()) .pipe(gulp.dest('dist/styles')); }); npm i -D gulp-load-plugins
  • 22. Debug gulp-plumber Prevent pipe breaking caused by errors from gulp plugins https://gist.github.com/floatdrop/8269868 gulp-debug Debug vinyl file streams to see what files are run through your gulp pipeline
  • 24. Require ? # lib/module.js exports.multiply = function multiply(a, b) { return a * b; } exports.add = function add(a, b) { return a + b; } # tests/module.js const assert = require('assert'); const mymath = require('../lib/module'); const multiply = mymath.multiply; describe('mymath', () => { describe('#multiply(a, b)', () => { it('should return 6 with 2 and 3', () => { assert.equal(6, multiply(2, 3)); assert.equal(6, multiply(3, 2)); }); }); });
  • 25. Browserify : require in the browser ! > npm install -g browserify > npm install --save jquery > browserify main.js -o dist/bundle.js const $ = require('jquery'); const mult = require('./lib/module').multiply; let $a = $('.num-a'); let $b = $('.num-b'); $('button').on('click', function onClick(event) { mult($a.val(), $b.val()); }); Terminal # main.js
  • 26. be prepared for ES6 Modules export function multiply(a, b) { … } import { multiply } from './lib/module'
  • 27. +≃
  • 28. ESLint Share style guides ! Avoid mistakes ! # .eslintrc /* * Extending the code style * of the devs at Airbnb */ { 'extends': 'eslint-config-airbnb' }
  • 31. This is just an overview ... Build your own gulpfile.js adapted to your tools and methods ! A sample we made for you : https://github.com/53js/simple-webapp/
  • 32. And now you need to choose a good JavaScript framework http://todomvc.com/