-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.ls
More file actions
81 lines (72 loc) · 1.9 KB
/
gulpfile.ls
File metadata and controls
81 lines (72 loc) · 1.9 KB
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
76
77
78
79
80
81
require! {
'path'
'nib'
'webpack'
'webpack-dev-server': WebpackDevServer
'gulp'
'gulp-util': gutil
'gulp-livescript': livescript
'gulp-stylus': stylus
'gulp-pug': pug
}
# http://stackoverflow.com/questions/7697038/more-than-10-lines-in-a-node-js-stack-error
#Error.stackTraceLimit = Infinity
options =
src: path.resolve './examples/main'
dist: path.resolve '.'
build: path.resolve '.'
gulp.task \js ->
gulp
.src "#{options.src}/**/*.ls"
.pipe livescript!
.pipe gulp.dest options.dist
gulp.task \css ->
gulp
.src "#{options.src}/**/*.styl"
.pipe stylus use: [nib!]
.pipe gulp.dest options.dist
gulp.task \compile <[js css]>
gulp.task \webpack <[compile]> ->
port = 8080
host = 'localhost'
config =
mode: 'development'
devtool: 'source-map'
entry:
* 'react-hot-loader/patch'
* "webpack-dev-server/client?http://#host:#port"
* 'webpack/hot/dev-server'
* './main.js'
output:
path: __dirname # required for webpack-dev-server
filename: 'bundle.js'
publicPath: '/'
resolve:
fallback:
stream: require.resolve('stream-browserify')
buffer: require.resolve('buffer')
plugins:
* new webpack.HotModuleReplacementPlugin
...
module:
rules:
* test: /\.css$/ use: \style-loader!css
...
server = new WebpackDevServer do
webpack config
publicPath: config.output.publicPath
hot: true
server.listen port, host, (err) ->
throw gutil.PluginError '[webpack-dev-server]', err if err
gutil.log "Listening at #host:#port"
gulp.task \html ->
gulp
.src "#{options.src}/*.jade"
.pipe pug!
.pipe gulp.dest options.build
gulp.task \watch <[html webpack]> ->
gulp
..watch "#{options.src}/**/*.ls" <[compile]>
..watch "#{options.src}/**/*.styl" <[compile]>
..watch "#{options.src}/*.pug" <[html]>
gulp.task \default <[watch]>