Created
March 4, 2017 19:56
-
-
Save Sankame/db5caad7d75a4064ef98f140a39de5bc 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'); | |
// gulpプラグイン | |
var concat = require('gulp-concat'); | |
var uglify = require('gulp-uglify'); | |
var minifyCss = require('gulp-minify-css'); | |
// タスクを定義 | |
gulp.task('js', function () { | |
gulp.src([ | |
'./path-to/js/*.js' | |
]) | |
// 実行順にpipeでつなぐ | |
// ファイルを結合し、bundle.jsファイルとして出力 | |
.pipe(concat('bundle.js')) | |
// ファイルを圧縮する | |
.pipe(uglify({preserveComments: 'some'})) | |
// 最後にdistディレクトリへ出力 | |
.pipe(gulp.dest('./path-to/js/dist')); | |
}); | |
gulp.task('css', function() { | |
return gulp.src([ | |
'./path-to/css/*.css' | |
]) | |
.pipe(concat('bundle.css')) | |
.pipe(minifyCss()) | |
.pipe(gulp.dest('./path-to/css/dist')); | |
}); | |
// 上記タスクをdefaultとして登録 | |
gulp.task('default', ['js','css']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment