Skip to content

Instantly share code, notes, and snippets.

@hidex7777
Created May 6, 2015 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hidex7777/f57cc29697f04a65addd to your computer and use it in GitHub Desktop.
Save hidex7777/f57cc29697f04a65addd to your computer and use it in GitHub Desktop.
Gulpでscss, coffee, imagemin, livereload
gulp = require 'gulp'
imagemin = require 'gulp-imagemin'
plumber = require 'gulp-plumber'
coffee = require 'gulp-coffee'
concat = require 'gulp-concat'
uglify = require 'gulp-uglify'
sass = require 'gulp-sass'
webserver = require 'gulp-webserver'
gulp.task 'img', ->
gulp.src ['./src/image/*.jpg', './src/image/*.png']
.pipe imagemin()
.pipe gulp.dest './dist/image'
gulp.task 'js', ->
gulp.src './src/coffee/*.coffee'
.pipe plumber()
.pipe coffee()
.pipe concat 'all.min.js'
.pipe uglify()
.pipe gulp.dest './dist/js'
gulp.task 'css', ->
gulp.src './src/scss/*.scss'
.pipe plumber()
.pipe sass()
.pipe gulp.dest './dist/css'
gulp.task 'watch', ->
gulp.watch './src/coffee/*.coffee', ['js']
gulp.watch './src/scss/*.scss', ['css']
gulp.watch './dist/*.html', ['watch']
gulp.task 'webserver', ->
gulp.src './dist'
.pipe webserver {
host: 'localhost'
livereload: true
}
gulp.task 'default', ['img', 'js', 'css', 'watch', 'webserver']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment