-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.coffee
71 lines (58 loc) · 2.04 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
gulp = require 'gulp'
gTasks = require 'gulp-tasks'
cPort = Number(process.env.PORT) if process.env.PORT?
lPort = cPort+1 if cPort?
base = "#{__dirname}/dest"
bower = "#{__dirname}/bower_components"
dest =
base: base
templates: "#{base}/templates"
assets: "#{base}/assets"
themes: "#{base}/assets/themes"
src =
scripts:
main: "#{__dirname}/client/scripts/main.coffee"
watch: "#{__dirname}/client/scripts/**/*.coffee"
templates:
index: "#{__dirname}/client/index.jade"
popup: "#{__dirname}/client/popup.jade"
files: "#{__dirname}/client/templates/**/*.jade"
styles:
index: "#{__dirname}/client/styles/main.less"
popup: "#{__dirname}/client/styles/popup.less"
files: "#{__dirname}/client/styles/**/*.less"
themes: "#{__dirname}/client/vendor/themes/**/*.less"
vendors: [
"#{__dirname}/client/vendor/**/*"
]
manifest: "#{__dirname}/manifest.json"
gulp.task 'build', [
'build:scripts'
'build:templates'
'build:styles'
]
gulp.task 'build:scripts', [
'build:scripts:app'
]
gulp.task 'build:scripts:app', ->
gTasks.browserify.build src.scripts.main, dest.base
gTasks.misc.copy src.vendors, dest.assets
gulp.task 'build:templates', ->
gTasks.jade.build src.templates.index, dest.base, lPort
gTasks.jade.build src.templates.popup, dest.base
gTasks.jade.build src.templates.files, dest.templates
gulp.task 'build:styles', ->
gTasks.less.build src.styles.index, dest.base
gTasks.less.build src.styles.popup, dest.base
gTasks.less.build src.styles.themes, dest.themes
gulp.task 'build:local', ['build'], ->
gTasks.misc.copy src.manifest, dest.base
gulp.task 'server', ->
gTasks.livereload.livereloadServer dest.base, lPort
gTasks.livereload.contentServer dest.base, cPort
gulp.task 'start', ['build', 'server']
gulp.task 'watch', ['build', 'server'], ->
gulp.watch src.scripts.watch, ['build:scripts:app']
gulp.watch [src.templates.index, src.templates.files], ['build:templates']
gulp.watch [src.styles.index, src.styles.files, src.styles.themes], ['build:styles']
gulp.task 'default', ['watch']