Created
September 20, 2014 13:54
-
-
Save nasum/516c2f44d2475b378f27 to your computer and use it in GitHub Desktop.
GulpでTypeScriptとSASS/COMPASSをコンパイルする ref: http://qiita.com/tomato360/items/528656d82aa270545624
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 typescript = require('gulp-tsc'); | |
var compass = require('gulp-compass'); | |
var plumber = require('gulp-plumber'); | |
//TypeScriptのタスク | |
gulp.task('typescript',function(){ | |
gulp.src(['src/ts/**/*.ts']) | |
.pipe(plumber()) //エラーしてもウォッチを途中でやめないための処理 | |
.pipe(typescript({module:"amd"})) //コンパイルする処理 moduleで出力するモジュールを指定 | |
.pipe(gulp.dest('src/js')); //ファイル出力先を指定 | |
}); | |
//Compassのタスク | |
gulp.task('compass',function(){ | |
gulp.src(['../stylesheets/sass/**/*.scss']) | |
.pipe(plumber()) | |
.pipe(compass({ //コンパイルする処理 | |
config_file : '../stylesheets/sass/config.rb', | |
comments : false, | |
css : '../stylesheets', | |
sass: '../stylesheets/sass/' | |
})); | |
}); | |
//watchのタスク | |
gulp.task('watch',function(){ | |
gulp.watch('src/ts/**/*.ts',function(event){ | |
gulp.run('typescript'); | |
}); | |
gulp.watch('../stylesheets/sass/**/*.scss',function(event){ | |
gulp.run('compass'); | |
}); | |
}); | |
//defaultで実行するタスクを設定 | |
gulp.task('default',function(){ | |
gulp.run('watch'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment