-
-
Save minwe/9503936 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
// gulpやプラグインをインポート | |
var gulp = require('gulp') | |
, compass = require('gulp-compass') | |
, concat = require('gulp-concat') | |
, uglify = require('gulp-uglify') | |
, minifyCSS = require('gulp-minify-css') | |
, path = require('path') | |
; | |
//JSファイルをjsフォルダにコピー | |
gulp.task('scripts', function() { | |
gulp.src('public_html/dev/**/*.js') | |
.pipe(gulp.dest('public_html/js')); | |
}); | |
//それぞれのJSファイルを結合 | |
gulp.task('concat', function() { | |
gulp.src(['public_html/dev/lib/jquery.js','public_html/dev/lib/jquery_easing_min.js']) | |
.pipe(concat("lib.js")) | |
.pipe(gulp.dest('public_html/js')); | |
gulp.src(['public_html/dev/hoge.js','public_html/dev/script.js']) | |
.pipe(concat("app.js")) | |
.pipe(uglify())//uglifyを使ってJSファイルをminify | |
.pipe(gulp.dest('public_html/js')); | |
}); | |
//Sassファイル(Compass)をコンパイル | |
gulp.task('compass', function() { | |
gulp.src('public_html/sass/*.scss') | |
.pipe(compass({ | |
project: path.join(__dirname, 'public_html'), | |
comments: false | |
})) | |
}); | |
//コンパイルされたCSSファイルをminify | |
gulp.task('css', function() { | |
gulp.src(['public_html/css/**/*.css']) | |
.pipe(minifyCSS()) | |
.pipe(gulp.dest('public_html/css')); | |
}); | |
// デフォルトタスク | |
gulp.task('default', function() { | |
gulp.run('css', 'scripts', 'concat'); | |
//JSファイルの変更を監視 | |
gulp.watch('public_html/dev/**', function(event) { | |
gulp.run('scripts'); | |
}); | |
gulp.watch('public_html/js/**', function(event) { | |
gulp.run('concat'); | |
}); | |
//Sassファイルの変更を監視 | |
gulp.watch('public_html/sass/**', function(event) { | |
gulp.run('compass'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment