-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
75 lines (57 loc) · 1.27 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
gulp = require("gulp")
$ = do require("gulp-load-plugins")
webpack = require("webpack")
browserSync = require("browser-sync").create()
webpackConfig = require("./webpack.config.coffee")
gulp.task("bs", ->
browserSync.init(
notify: false
server:
baseDir: "./dist/"
)
)
gulp.task("bs:reload", ->
browserSync.reload()
)
gulp.task("assets-copy", ->
gulp.src("./assets/**/*", base: "./assets")
.pipe(gulp.dest("./dist"))
.pipe(browserSync.stream())
)
gulp.task("sass", ->
$.rubySass("./src/sass/",
style: "compressed"
stopOnError: true
)
.pipe($.autoprefixer())
.pipe(gulp.dest("./dist/css"))
.pipe(browserSync.stream())
)
gulp.task("webpack", (cb) ->
webpack(webpackConfig, (err, stats) ->
if err
throw new $.util.PluginError("webpack", err)
$.util.log("[webpack]", stats.toString())
browserSync.reload()
cb()
)
)
gulp.task("build", ->
gulp.start("assets-copy")
gulp.start("sass")
gulp.start("webpack")
)
gulp.task("watch", ["bs", "build"], ->
$.watch("./assets/**/*", ->
gulp.start("assets-copy")
)
$.watch("./src/coffee/**/*", ->
gulp.start("webpack")
)
$.watch("./src/sass/**/*", ->
gulp.start("sass")
)
)
gulp.task("default", ->
gulp.start("watch")
)