Skip to content

Instantly share code, notes, and snippets.

@aloerina01
Last active October 23, 2016 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aloerina01/1e876b9beb99e46a2fa2458ce09432a7 to your computer and use it in GitHub Desktop.
Save aloerina01/1e876b9beb99e46a2fa2458ce09432a7 to your computer and use it in GitHub Desktop.
ビルド環境雛形
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