Created
September 7, 2014 16:47
-
-
Save teitei-tk/ee26fce1100891acfc3f to your computer and use it in GitHub Desktop.
GulpでCoffeeScript、Sassをコンパイル ref: http://qiita.com/teitei_tk/items/6a9833e4308b3769811d
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
$ npm install -g gulp | |
$ npm install --save-dev gulp gulp-coffee gulp-sass |
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 compile-coffee |
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 compile-sass |
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
$ npm install --save-dev gulp-uglify gulp-minify-css gulp-concat |
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 compile |
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 = require 'gulp' | |
coffee = require 'gulp-coffee' | |
uglify = require 'gulp-uglify' | |
sass = require 'gulp-sass' | |
minifyCss = require 'gulp-minify-css' | |
concat = require 'gulp-concat' | |
# compile coffeescript files | |
gulp.task 'compile-coffee', () -> | |
gulp.src '/path/to/coffee/**/*.coffee' | |
.pipe coffee() | |
.pipe gulp.dest('/path/to/js') | |
# ugilify js file and concat javascript file to application.js | |
gulp.task 'compile-js', () -> | |
compileFileName = 'application.js' | |
gulp.src ['/path/to/js/**/*.js' '!/path/to/js/' + compileFileName] | |
.pipe concat(compileFileName) | |
.pipe uglify(preserveComments:'some') | |
.pipe gulp.dest('/path/to/js') | |
# compile sass file | |
gulp.task 'compile-sass', () -> | |
gulp.src '/path/to/sass/**/*.scss' | |
.pipe sass() | |
.pipe gulp.dest('/path/to/css/') | |
gulp.task 'compile-css', () -> | |
compileFileName = 'application.css' | |
gulp.src [ '/path/to/css/**/*.css', | |
'!/path/to/css/' + compileFileName ] | |
.pipe concat(compileFileName) | |
.pipe minifyCss() | |
.pipe gulp.dest('/path/to/css') | |
gulp.task 'compile', ['compile-coffee', 'compile-sass', 'compile-js', 'compile-css'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment