Last active
October 23, 2016 15:30
-
-
Save aloerina01/1e876b9beb99e46a2fa2458ce09432a7 to your computer and use it in GitHub Desktop.
ビルド環境雛形
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var del = require('del'); | |
var webpack = require('gulp-webpack'); | |
var eslint = require('gulp-eslint'); | |
var plumber = require('gulp-plumber'); | |
var notify = require('gulp-notify'); | |
var webpackConfig = require('./webpack.config.js'); | |
gulp.task('clean', function() { | |
return del.sync(['dist']); | |
}); | |
gulp.task('build', function() { | |
return gulp.src('./js/*.js') | |
.pipe(plumber({ | |
errorHandler: notify.onError("Error: <%= error.message %>") | |
})) | |
.pipe(eslint({useEslintrc: true})) | |
.pipe(eslint.format()) | |
.pipe(eslint.failOnError()) | |
.pipe(webpack(webpackConfig)) | |
.pipe(gulp.dest('./dist')); | |
}); | |
gulp.task('sass', function() { | |
// (省略) | |
}); | |
gulp.task('watch', function() { | |
gulp.watch(['./js/*.js'], ['build']); | |
gulp.watch(['./sass/*.scss'], ['sass']); | |
}); | |
gulp.task('default', ['clean', 'build', 'sass', 'watch']); | |
gulp.task('minify', ['js-minify', 'css-minify']); | |
gulp.task('production', ['clean', 'build', 'sass', 'minify']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment