Skip to content

Instantly share code, notes, and snippets.

@nasum
Created September 20, 2014 13:54
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 nasum/516c2f44d2475b378f27 to your computer and use it in GitHub Desktop.
Save nasum/516c2f44d2475b378f27 to your computer and use it in GitHub Desktop.
GulpでTypeScriptとSASS/COMPASSをコンパイルする ref: http://qiita.com/tomato360/items/528656d82aa270545624
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