-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.cirru
116 lines (100 loc) · 2.65 KB
/
gulpfile.cirru
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
var
fs $ require :fs
gulp $ require :gulp
gutil $ require :gulp-util
sequence $ require :run-sequence
settings $ require :./tasks/settings
env :dev
gulp.task :rsync $ \ (cb)
var
wrapper $ require :rsyncwrapper
wrapper.rsync
{}
:ssh true
:src $ array :build/*
:recursive true
:args $ array :--verbose
:dest :tiye:~/repo/routed-modal/
:deleteAll true
\ (error stdout stderr cmd)
if (? error)
do $ throw error
console.error stderr
console.log cmd
cb
gulp.task :script $ \ ()
var
script $ require :gulp-cirru-script
... gulp
src :src/*.cirru
pipe $ script
pipe $ gulp.dest :lib/
gulp.task :html $ \ (cb)
var
html $ require :./tasks/template
fs $ require :fs
fs.writeFile :build/index.html (html env) cb
gulp.task :del $ \ (cb)
var
del $ require :del
del (array :build/**/*) cb
gulp.task :webpack-dev $ \ (cb)
var
webpack $ require :webpack
webpackDev $ require :./tasks/webpack-dev
WebpackDevServer $ require :webpack-dev-server
config $ settings.get :dev
var webpackServer $ {}
:publicPath :/
:hot true
:stats $ {}
:colors true
var info $ {}
:__dirname __dirname
:env env
var compiler $ webpack (webpackDev info)
var server $ new WebpackDevServer compiler webpackServer
server.listen config.port :localhost $ \ (err)
if (? err) $ do
throw $ new gutil.PluginError :webpack-dev-server err
gutil.log ":[webpack-dev-server] is running..."
cb
gulp.task :webpack-build $ \ (cb)
var
webpack $ require :webpack
webpackBuild $ require :./tasks/webpack-build
config $ settings.get env
var info $ {}
:__dirname __dirname
:isMinified config.isMinified
:useCDN config.useCDN
:cdn config.cdn
:env config.env
webpack (webpackBuild info) $ \ (err stats)
if err $ do
throw $ new gutil.PluginError :webpack err
gutil.log :[webpack] (stats.toString)
var jsonData $ stats.toJson
var fileContent $ JSON.stringify jsonData.assetsByChunkName
fs.writeFileSync :tasks/assets.json fileContent
cb
gulp.task :webpack-server $ \ (cb)
var
webpack $ require :webpack
serverConfig $ require :./tasks/webpack-server
... (webpack serverConfig) $ run $ \ (err stats)
if err
do $ console.log err
do $ console.log (stats.toString)
cb
... (webpack serverConfig) $ watch 100 $ \ (err stats)
if err
do $ console.log err
do $ console.log (stats.toString)
, null
-- ":aliases"
gulp.task :dev $ \ (cb)
sequence :html :webpack-dev cb
gulp.task :build $ \ (cb)
= env :build
sequence :del :webpack-build :html cb