-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.coffee
58 lines (50 loc) · 1.63 KB
/
gulpfile.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
gulp = require("gulp")
uglify = require("gulp-uglify")
browserify = require("browserify")
gutil = require("gulp-util")
sass = require("gulp-sass")
autoprefixer = require("gulp-autoprefixer")
path = require("path")
coffeeify = require("coffeeify")
source = require('vinyl-source-stream')
streamify = require('gulp-streamify')
cssmin = require('gulp-cssmin')
livereload = require("gulp-livereload")
paths =
scripts: "./assets/javascripts/**/*.coffee"
styles: "./assets/stylesheets/**/*.sass"
images: "./assets/images/**/*"
views: "./views/**/*.jade"
dest: "./build/"
gulp.task "scripts", ->
bundleStream = browserify(
entries: ["./assets/javascripts/app.coffee"]
debug: true
).transform("coffeeify").bundle()
bundleStream
.on("error", gutil.log)
.pipe(source("app.js"))
.pipe(streamify(uglify()))
.pipe(gulp.dest(path.join(paths.dest, "javascripts")))
gulp.src("./vendor/html5shiv/dist/html5shiv.min.js")
.pipe(gulp.dest(path.join(paths.dest, "javascripts")))
gulp.task "styles", ->
gulp.src(paths.styles)
.pipe(sass(
indentedSyntax: true
errorLogToConsole: true
onError: gutil.log
))
.pipe(autoprefixer("last 1 version", "> 1%", "ie 8", "ie 7"))
.pipe(cssmin())
.on("error", gutil.log)
.pipe(gulp.dest(path.join(paths.dest, "stylesheets")))
gulp.task "livereload", ->
livereload.reload()
gulp.task "watch", ->
livereload.listen()
gulp.watch paths.scripts, ["scripts", "livereload"]
gulp.watch paths.styles, ["styles", "livereload"]
gulp.watch paths.views, ["livereload"]
gulp.task "default", ["scripts", "styles", "watch"]
gulp.task "deploy", ["scripts", "styles"]