HITCHHIKER'S
GUIDE TO THE FRONT-END
@kjy2143
1
11st. Front End Developer
2 . 1
2 . 2
2 . 3
2 . 4
today
3 . 1
Front End Developer
in 2016
3 . 2
3 . 3
spinner
3 . 4
Front End Developer
in past
4 . 1
4 . 2
Front End Developer
in 2016
5 . 1
http://m.11st.co.kr/
5 . 2
5 . 3
5 . 4
require.js
5 . 5
5 . 6
webpack
5 . 7
webpack
5 . 8
webpack
5 . 9
webpack
5 . 10
scss css
$primary-color: #333;
@mixin border-radius($radius) {
border-radius: $radius;
}
%message {
border: 1px solid #ccc;
padding: 10px;
}
.wrap {
@include border-radius(10px);
color: $primary-color;
.box {
display:flex;
}
}
.success {
@extend %message;
border-color: green;
}
.error {
@extend %message;
border-color: red;
}
.warning {
@extend %message;
border-color: yellow;
}
.success, .error, .warning {
border: 1px solid #ccc;
padding: 10px;
}
.wrap {
border-radius: 10px;
color: #333;
}
.wrap .box {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.success {
border-color: green;
}
.error {
border-color: red;
}
.warning {
border-color: yellow;
}
sass
5 . 11
scss css
$primary-color: #333;
@mixin border-radius($radius) {
border-radius: $radius;
}
%message {
border: 1px solid #ccc;
padding: 10px;
}
.wrap {
@include border-radius(10px);
color: $primary-color;
.box {
display:flex;
}
}
.success {
@extend %message;
border-color: green;
}
.error {
@extend %message;
border-color: red;
}
.warning {
@extend %message;
border-color: yellow;
}
.success, .error, .warning {
border: 1px solid #ccc;
padding: 10px;
}
.wrap {
border-radius: 10px;
color: #333;
}
.wrap .box {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.success {
border-color: green;
}
.error {
border-color: red;
}
.warning {
border-color: yellow;
}
sass
5 . 12
scss css
$primary-color: #333;
@mixin border-radius($radius) {
border-radius: $radius;
}
%message {
border: 1px solid #ccc;
padding: 10px;
}
.wrap {
@include border-radius(10px);
color: $primary-color;
.box {
display:flex;
}
}
.success {
@extend %message;
border-color: green;
}
.error {
@extend %message;
border-color: red;
}
.warning {
@extend %message;
border-color: yellow;
}
.success, .error, .warning {
border: 1px solid #ccc;
padding: 10px;
}
.wrap {
border-radius: 10px;
color: #333;
}
.wrap .box {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.success {
border-color: green;
}
.error {
border-color: red;
}
.warning {
border-color: yellow;
}
sass
5 . 13
scss css
$primary-color: #333;
@mixin border-radius($radius) {
border-radius: $radius;
}
%message {
border: 1px solid #ccc;
padding: 10px;
}
.wrap {
@include border-radius(10px);
color: $primary-color;
.box {
display:flex;
}
}
.success {
@extend %message;
border-color: green;
}
.error {
@extend %message;
border-color: red;
}
.warning {
@extend %message;
border-color: yellow;
}
.success, .error, .warning {
border: 1px solid #ccc;
padding: 10px;
}
.wrap {
border-radius: 10px;
color: #333;
}
.wrap .box {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.success {
border-color: green;
}
.error {
border-color: red;
}
.warning {
border-color: yellow;
}
sass
5 . 14
sass
5 . 15
sass
5 . 16
5 . 17
5 . 18
5 . 19
5 . 20
5 . 21
2016/2017 MUST-KNOW
WEB DEVELOPMENT TECH
CSS Preprocessor Compile
ES2016+ Compile
Optimization
Linting
Unit Testing
Module Bundling
Package Management
5 . 22
Automation
6 . 1
GRUNT
The JavaScript Task Runner
6 . 2
module.exports = function(grunt){
grunt.initConfig({
clean: ['dist/'],
less: {
production: {
files: {
"src/css/combined.css" : "src/less/main.less"
}
}
},
jshint: {
options: {
reporter: require('jshint-stylish'),
jshintrc: true
},
all: ['Gruntfile.js', 'src/js/compiled.js']
}]
});
// Add plugins
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Register tasks
grunt.registerTask('default', ['clean', 'jshint']);
};
Grunt
6 . 3
Grunt
6 . 4
Grunt
6 . 5
Automate and enhance your workflow
6 . 6
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import del from 'del';
import browserSync from 'browser-sync';
import runSequence from 'run-sequence';
gulp.task('font', () => {
return gulp.src(config.src.font)
.pipe(gulp.dest(`${config.dist}/font`));
});
gulp.task('img', () => {
return gulp.src(config.src.img)
.pipe(gulp.dest(`${config.dist}/img`));
});
gulp.task('styles', () => {
gulp.src(`${config.src.styles}/custom.scss`)
.pipe($.sass({
includePaths: ['./node_modules/material-design-lite/src']
}))
.pipe($.minifyCss())
.pipe(gulp.dest(`${config.dist}/css`))
.pipe(browserSync.stream());
});
gulp.task('clean', del.bind(null, [config.dist]));
gulp.task('build', cb => {
runSequence('clean', ['styles','font', 'img'], cb);
});
Gulp
6 . 7
Gulp
6 . 8
Gulp
6 . 9
{
"name": "spinner",
"scripts": {
"clean": "rimraf dist",
"spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf dist/tmp",
"sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/",
"autoprefixer": "postcss -u autoprefixer -r dist/css/*.css",
"build:spritesmith": "npm run spritesmith",
"build:css": "npm-run-all --sequential sass autoprefixer",
"dev:js": "webpack -d --watch --config webpack.dev.config.js",
"build:js": "webpack -p --config webpack.prd.config.js",
"build": "npm run clean && npm-run-all --sequential build:*",
"watch:css": "onchange "src/sass" -- npm run build:css",
"watch:js": "onchange "src/js" -- npm run dev:js",
"watch": "npm-run-all --parallel watch:*",
"serve": "browser-sync start --server --port 8081 --directory --no-ui --files "dist/**/*.*, doc/**/*.*"",
"start": "npm run build && npm-run-all --parallel serve watch"
},
"homepage": "https://github.com/poohding/spinner#readme"
}
npm scripts(package.json)
6 . 10
npm scripts(package.json)
6 . 11
spinner
https://github.com/poohding/spinner
7 . 1
Development Platform & IDE
Version Control System
&
Package Management
CSS Preprocess
(CSS Concatenating & Minify)
(autoprefixer plugin)
Optimization
goorm.io
Git github
NPM
Sass
PostCSS
CSS Sprites
Image Minify
MVC JavaScript Framework
+ &
UI Library
JavaScript Task Runner
​
Vanilla JS
ES 2016 Webpack Babel.js
Vanilla JS
NPM Scripts
spinner
7 . 2
goorm
https://www.goorm.io/
8 . 1
8 . 2
8 . 3
8 . 4
8 . 5
8 . 6
8 . 7
8 . 8
8 . 9
8 . 10
8 . 11
8 . 12
Node.js & NPM Upgrade
$ npm -v
1.4.28
$ npm install npm@latest -g
$ npm -v
3.10.9
$ node -v
v0.10.38
$ npm install -g n
$ n stable
$ node -v
v0.10.38
8 . 13
8 . 14
git clone & npm install
$ git clone https://github.com/poohding/spinner.git
$ cd spinner
$ npm install
8 . 15
8 . 16
8 . 17
8 . 18
8 . 19
8 . 20
8 . 21
https://{{id}}_prd.goorm.io/practice/spinner/doc/spinner.html
8 . 22
Add HTML
$ git checkout add_html
9 . 1
9 . 2
9 . 3
Add Sass
$ git reset --hard HEAD
$ git checkout add_sass
10 . 1
{
"scripts": {
"clean": "rimraf dist",
"spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d
"sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/",
"build:spritesmith": "npm run spritesmith",
"build:css": "npm run sass",
"build": "npm run clean && npm-run-all --sequential build:*"
}
}
npm run build
package.json
usage
10 . 2
10 . 3
Change Image
$ git reset --hard HEAD
$ git checkout change_image
11 . 1
{
"scripts": {
"clean": "rimraf dist",
"spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d
"sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/",
"build:spritesmith": "npm run spritesmith",
"build:css": "npm run sass",
"build": "npm run clean && npm-run-all --sequential build:*"
}
}
npm run build
package.json
usage
11 . 2
11 . 3
Add Serve
$ git reset --hard HEAD
$ git checkout add_serve
12 . 1
{
"scripts": {
"clean": "rimraf dist",
"spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d
"sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/",
"build:spritesmith": "npm run spritesmith",
"build:css": "npm run sass",
"build": "npm run clean && npm-run-all --sequential build:*",
"watch:css": "onchange "src/sass" -- npm run build:css",
"watch": "npm-run-all --parallel watch:*",
"serve": "browser-sync start --server --port 8081 --directory --no-ui --files "dist/**/*.*, do
"start": "npm run build && npm-run-all --parallel serve watch"
}
}
npm run build
npm start
package.json
usage
12 . 2
Add Style
$ git reset --hard HEAD
$ git checkout add_style
13 . 1
{
"scripts": {
"clean": "rimraf dist",
"spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d
"sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/",
"autoprefixer": "postcss -u autoprefixer -r dist/css/*.css",
"build:spritesmith": "npm run spritesmith",
"build:css": "npm-run-all --sequential sass autoprefixer",
"build": "npm run clean && npm-run-all --sequential build:*",
"watch:css": "onchange "src/sass" -- npm run build:css",
"watch": "npm-run-all --parallel watch:*",
"serve": "browser-sync start --server --port 8081 --directory --no-ui --files "dist/**/*.*, do
"start": "npm run build && npm-run-all --parallel serve watch"
}
}
npm run build
npm start
package.json
usage
13 . 2
13 . 3
Add Webpack
$ git reset --hard HEAD
$ git checkout add_webpack
14 . 1
{
"scripts": {
"clean": "rimraf dist",
"spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d
"sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/",
"autoprefixer": "postcss -u autoprefixer -r dist/css/*.css",
"build:spritesmith": "npm run spritesmith",
"build:css": "npm-run-all --sequential sass autoprefixer",
"dev:js": "webpack -d --watch --config webpack.dev.config.js",
"build:js": "webpack -p --config webpack.prd.config.js",
"build": "npm run clean && npm-run-all --sequential build:*",
"watch:css": "onchange "src/sass" -- npm run build:css",
"watch:js": "onchange "src/js" -- npm run dev:js",
"watch": "npm-run-all --parallel watch:*",
"serve": "browser-sync start --server --port 8081 --directory --no-ui --files "dist/**/*.*, do
"start": "npm run build && npm-run-all --parallel serve watch"
}
}
npm run build
npm start
package.json
usage
14 . 2
webpack.common.config.js
module.exports = {
entry: './src/js/spinner.js',
output: {
path: './dist/js',
filename: 'spinner.bundle.js',
},
module: {
loaders: [{
test: /.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015']
}
}]
},
plugins: []
};
14 . 3
webpack.dev.config.js
var config = require('./webpack.common.config'),
webpack = require('webpack');
config.devtool = 'eval';
module.exports = config;
14 . 4
webpack.prd.config.js
var config = require('./webpack.common.config'),
webpack = require('webpack');
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false,
}
})
);
config.devtool = 'sourcemap';
module.exports = config;
14 . 5
wrap up
15 . 1
Front End Developer
in 2016
15 . 2
15 . 3
2016/2017 MUST-KNOW
WEB DEVELOPMENT TECH
CSS Preprocessor Compile
ES2016+ Compile
Optimization
Linting
Unit Testing
Module Bundling
Package Management
15 . 4
spinner
https://github.com/poohding/spinner
15 . 5
Development Platform & IDE
Version Control System
&
Package Management
CSS Preprocess
(CSS Concatenating & Minify)
(autoprefixer plugin)
Optimization
goorm.io
Git github
NPM
Sass
PostCSS
CSS Sprites
Image Minify
MVC JavaScript Framework
+ &
UI Library
JavaScript Task Runner
​
Vanilla JS
ES 2016 Webpack Babel.js
Vanilla JS
NPM Scripts
spinner
15 . 6
THANK YOU.
15 . 7

Hitchhiker's guide to the front end development

  • 1.
    HITCHHIKER'S GUIDE TO THEFRONT-END @kjy2143 1
  • 2.
    11st. Front EndDeveloper 2 . 1
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
    scss css $primary-color: #333; @mixinborder-radius($radius) { border-radius: $radius; } %message { border: 1px solid #ccc; padding: 10px; } .wrap { @include border-radius(10px); color: $primary-color; .box { display:flex; } } .success { @extend %message; border-color: green; } .error { @extend %message; border-color: red; } .warning { @extend %message; border-color: yellow; } .success, .error, .warning { border: 1px solid #ccc; padding: 10px; } .wrap { border-radius: 10px; color: #333; } .wrap .box { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } .success { border-color: green; } .error { border-color: red; } .warning { border-color: yellow; } sass 5 . 11
  • 23.
    scss css $primary-color: #333; @mixinborder-radius($radius) { border-radius: $radius; } %message { border: 1px solid #ccc; padding: 10px; } .wrap { @include border-radius(10px); color: $primary-color; .box { display:flex; } } .success { @extend %message; border-color: green; } .error { @extend %message; border-color: red; } .warning { @extend %message; border-color: yellow; } .success, .error, .warning { border: 1px solid #ccc; padding: 10px; } .wrap { border-radius: 10px; color: #333; } .wrap .box { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } .success { border-color: green; } .error { border-color: red; } .warning { border-color: yellow; } sass 5 . 12
  • 24.
    scss css $primary-color: #333; @mixinborder-radius($radius) { border-radius: $radius; } %message { border: 1px solid #ccc; padding: 10px; } .wrap { @include border-radius(10px); color: $primary-color; .box { display:flex; } } .success { @extend %message; border-color: green; } .error { @extend %message; border-color: red; } .warning { @extend %message; border-color: yellow; } .success, .error, .warning { border: 1px solid #ccc; padding: 10px; } .wrap { border-radius: 10px; color: #333; } .wrap .box { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } .success { border-color: green; } .error { border-color: red; } .warning { border-color: yellow; } sass 5 . 13
  • 25.
    scss css $primary-color: #333; @mixinborder-radius($radius) { border-radius: $radius; } %message { border: 1px solid #ccc; padding: 10px; } .wrap { @include border-radius(10px); color: $primary-color; .box { display:flex; } } .success { @extend %message; border-color: green; } .error { @extend %message; border-color: red; } .warning { @extend %message; border-color: yellow; } .success, .error, .warning { border: 1px solid #ccc; padding: 10px; } .wrap { border-radius: 10px; color: #333; } .wrap .box { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } .success { border-color: green; } .error { border-color: red; } .warning { border-color: yellow; } sass 5 . 14
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
    2016/2017 MUST-KNOW WEB DEVELOPMENTTECH CSS Preprocessor Compile ES2016+ Compile Optimization Linting Unit Testing Module Bundling Package Management 5 . 22
  • 34.
  • 35.
  • 36.
    module.exports = function(grunt){ grunt.initConfig({ clean:['dist/'], less: { production: { files: { "src/css/combined.css" : "src/less/main.less" } } }, jshint: { options: { reporter: require('jshint-stylish'), jshintrc: true }, all: ['Gruntfile.js', 'src/js/compiled.js'] }] }); // Add plugins grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-jshint'); // Register tasks grunt.registerTask('default', ['clean', 'jshint']); }; Grunt 6 . 3
  • 37.
  • 38.
  • 39.
    Automate and enhanceyour workflow 6 . 6
  • 40.
    import gulp from'gulp'; import gulpLoadPlugins from 'gulp-load-plugins'; import del from 'del'; import browserSync from 'browser-sync'; import runSequence from 'run-sequence'; gulp.task('font', () => { return gulp.src(config.src.font) .pipe(gulp.dest(`${config.dist}/font`)); }); gulp.task('img', () => { return gulp.src(config.src.img) .pipe(gulp.dest(`${config.dist}/img`)); }); gulp.task('styles', () => { gulp.src(`${config.src.styles}/custom.scss`) .pipe($.sass({ includePaths: ['./node_modules/material-design-lite/src'] })) .pipe($.minifyCss()) .pipe(gulp.dest(`${config.dist}/css`)) .pipe(browserSync.stream()); }); gulp.task('clean', del.bind(null, [config.dist])); gulp.task('build', cb => { runSequence('clean', ['styles','font', 'img'], cb); }); Gulp 6 . 7
  • 41.
  • 42.
  • 43.
    { "name": "spinner", "scripts": { "clean":"rimraf dist", "spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf dist/tmp", "sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/", "autoprefixer": "postcss -u autoprefixer -r dist/css/*.css", "build:spritesmith": "npm run spritesmith", "build:css": "npm-run-all --sequential sass autoprefixer", "dev:js": "webpack -d --watch --config webpack.dev.config.js", "build:js": "webpack -p --config webpack.prd.config.js", "build": "npm run clean && npm-run-all --sequential build:*", "watch:css": "onchange "src/sass" -- npm run build:css", "watch:js": "onchange "src/js" -- npm run dev:js", "watch": "npm-run-all --parallel watch:*", "serve": "browser-sync start --server --port 8081 --directory --no-ui --files "dist/**/*.*, doc/**/*.*"", "start": "npm run build && npm-run-all --parallel serve watch" }, "homepage": "https://github.com/poohding/spinner#readme" } npm scripts(package.json) 6 . 10
  • 44.
  • 45.
  • 46.
    Development Platform &IDE Version Control System & Package Management CSS Preprocess (CSS Concatenating & Minify) (autoprefixer plugin) Optimization goorm.io Git github NPM Sass PostCSS CSS Sprites Image Minify MVC JavaScript Framework + & UI Library JavaScript Task Runner ​ Vanilla JS ES 2016 Webpack Babel.js Vanilla JS NPM Scripts spinner 7 . 2
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
    Node.js & NPMUpgrade $ npm -v 1.4.28 $ npm install npm@latest -g $ npm -v 3.10.9 $ node -v v0.10.38 $ npm install -g n $ n stable $ node -v v0.10.38 8 . 13
  • 60.
  • 61.
    git clone &npm install $ git clone https://github.com/poohding/spinner.git $ cd spinner $ npm install 8 . 15
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
    Add HTML $ gitcheckout add_html 9 . 1
  • 70.
  • 71.
  • 72.
    Add Sass $ gitreset --hard HEAD $ git checkout add_sass 10 . 1
  • 73.
    { "scripts": { "clean": "rimrafdist", "spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d "sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/", "build:spritesmith": "npm run spritesmith", "build:css": "npm run sass", "build": "npm run clean && npm-run-all --sequential build:*" } } npm run build package.json usage 10 . 2
  • 74.
  • 75.
    Change Image $ gitreset --hard HEAD $ git checkout change_image 11 . 1
  • 76.
    { "scripts": { "clean": "rimrafdist", "spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d "sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/", "build:spritesmith": "npm run spritesmith", "build:css": "npm run sass", "build": "npm run clean && npm-run-all --sequential build:*" } } npm run build package.json usage 11 . 2
  • 77.
  • 78.
    Add Serve $ gitreset --hard HEAD $ git checkout add_serve 12 . 1
  • 79.
    { "scripts": { "clean": "rimrafdist", "spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d "sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/", "build:spritesmith": "npm run spritesmith", "build:css": "npm run sass", "build": "npm run clean && npm-run-all --sequential build:*", "watch:css": "onchange "src/sass" -- npm run build:css", "watch": "npm-run-all --parallel watch:*", "serve": "browser-sync start --server --port 8081 --directory --no-ui --files "dist/**/*.*, do "start": "npm run build && npm-run-all --parallel serve watch" } } npm run build npm start package.json usage 12 . 2
  • 80.
    Add Style $ gitreset --hard HEAD $ git checkout add_style 13 . 1
  • 81.
    { "scripts": { "clean": "rimrafdist", "spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d "sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/", "autoprefixer": "postcss -u autoprefixer -r dist/css/*.css", "build:spritesmith": "npm run spritesmith", "build:css": "npm-run-all --sequential sass autoprefixer", "build": "npm run clean && npm-run-all --sequential build:*", "watch:css": "onchange "src/sass" -- npm run build:css", "watch": "npm-run-all --parallel watch:*", "serve": "browser-sync start --server --port 8081 --directory --no-ui --files "dist/**/*.*, do "start": "npm run build && npm-run-all --parallel serve watch" } } npm run build npm start package.json usage 13 . 2
  • 82.
  • 83.
    Add Webpack $ gitreset --hard HEAD $ git checkout add_webpack 14 . 1
  • 84.
    { "scripts": { "clean": "rimrafdist", "spritesmith": "spritesmith --rc .spritesmith.js && imagemin dist/tmp/* -o dist/img && rimraf d "sass": "node-sass --output-style expanded --source-map true src/sass/*.scss -o dist/css/", "autoprefixer": "postcss -u autoprefixer -r dist/css/*.css", "build:spritesmith": "npm run spritesmith", "build:css": "npm-run-all --sequential sass autoprefixer", "dev:js": "webpack -d --watch --config webpack.dev.config.js", "build:js": "webpack -p --config webpack.prd.config.js", "build": "npm run clean && npm-run-all --sequential build:*", "watch:css": "onchange "src/sass" -- npm run build:css", "watch:js": "onchange "src/js" -- npm run dev:js", "watch": "npm-run-all --parallel watch:*", "serve": "browser-sync start --server --port 8081 --directory --no-ui --files "dist/**/*.*, do "start": "npm run build && npm-run-all --parallel serve watch" } } npm run build npm start package.json usage 14 . 2
  • 85.
    webpack.common.config.js module.exports = { entry:'./src/js/spinner.js', output: { path: './dist/js', filename: 'spinner.bundle.js', }, module: { loaders: [{ test: /.js$/, exclude: /node_modules/, loader: 'babel', query: { presets: ['es2015'] } }] }, plugins: [] }; 14 . 3
  • 86.
    webpack.dev.config.js var config =require('./webpack.common.config'), webpack = require('webpack'); config.devtool = 'eval'; module.exports = config; 14 . 4
  • 87.
    webpack.prd.config.js var config =require('./webpack.common.config'), webpack = require('webpack'); config.plugins.push( new webpack.optimize.UglifyJsPlugin({ compressor: { warnings: false, } }) ); config.devtool = 'sourcemap'; module.exports = config; 14 . 5
  • 88.
  • 89.
  • 90.
  • 91.
    2016/2017 MUST-KNOW WEB DEVELOPMENTTECH CSS Preprocessor Compile ES2016+ Compile Optimization Linting Unit Testing Module Bundling Package Management 15 . 4
  • 92.
  • 93.
    Development Platform &IDE Version Control System & Package Management CSS Preprocess (CSS Concatenating & Minify) (autoprefixer plugin) Optimization goorm.io Git github NPM Sass PostCSS CSS Sprites Image Minify MVC JavaScript Framework + & UI Library JavaScript Task Runner ​ Vanilla JS ES 2016 Webpack Babel.js Vanilla JS NPM Scripts spinner 15 . 6
  • 94.