-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.ls
More file actions
executable file
·126 lines (104 loc) · 3.62 KB
/
gulpfile.ls
File metadata and controls
executable file
·126 lines (104 loc) · 3.62 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
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
117
118
119
120
121
122
123
124
125
126
require! <[tiny-lr]>
require! <[gulp gulp-util gulp-stylus gulp-karma gulp-livereload gulp-livescript streamqueue gulp-if]>
gutil = gulp-util
{argv} = require 'yargs'
livereload-server = require('tiny-lr')!
livereload = -> gulp-livereload livereload-server
var http-server
production = true if gutil.env.env is \production
gulp.task 'httpServer' ->
require! express
app = express!
app.use require('connect-livereload')!
app.use '/' express.static "_public"
app.all '/**' (req, res, next) ->
res.sendfile __dirname + '/_public/index.html'
# use http-server here so we can close after protractor finishes
http-server := require 'http' .create-server app
port = 3333
http-server.listen port, ->
console.log "Running on http://localhost:#port"
gulp.task 'build' <[template bower assets js:vendor js:app css]>
gulp.task 'test:unit' <[build]> -> gulp.start 'test:karma'
gulp.task 'test:karma' ->
gulp.src [
* "_public/js/vendor.js"
* "_public/js/app.templates.js"
* "_public/js/app.js"
* "bower_components/angular-mocks/angular-mocks.js"
* "node_modules/sinon/pkg/sinon.js"
* "node_modules/sinon-chai/lib/sinon-chai.js"
* "test/unit/**/*.spec.ls"
]
.pipe gulp-karma do
config-file: 'test/karma.conf.ls'
action: (if argv.w then \watch else \run)
browsers: <[PhantomJS]>
.on 'error' ->
console.log it
throw it
gulp.task 'dev' <[httpServer template assets js:vendor js:app css]> ->
LIVERELOADPORT = 35729
livereload-server.listen LIVERELOADPORT, ->
return gutil.log it if it
gulp.watch ['app/**/*.jade'] <[template]>
gulp.watch ['src/**/*.ls', 'sample/**/*.ls', 'app/**/*.jsenv'] <[js:app]>
gulp.watch 'app/assets/**' <[assets]>
gulp.watch 'app/**/*.styl' <[css]>
require! <[gulp-jade]>
gulp.task 'template' <[index]> ->
gulp.src ['app/partials/**/*.jade']
.pipe gulp-jade!
.pipe gulp.dest '_public/js'
.pipe livereload!
gulp.task 'index' ->
pretty = 'yes' if gutil.env.env isnt \production
gulp.src ['sample/*.jade']
.pipe gulp-jade {pretty}
.pipe gulp.dest '_public'
.pipe livereload!
require! <[gulp-bower gulp-bower-files gulp-filter gulp-uglify gulp-csso]>
require! <[gulp-concat gulp-json-editor gulp-commonjs gulp-insert]>
gulp.task 'bower' -> gulp-bower!
gulp.task 'js:app' ->
env = gulp.src 'src/**/*.jsenv'
.pipe gulp-json-editor (json) ->
for key of json when process.env[key]?
json[key] = that
json
.pipe gulp-insert.prepend 'module.exports = '
.pipe gulp-commonjs!
app = gulp.src [
'src/**/*.ls'
'sample/**/*.ls'
]
.pipe gulp-livescript {const : true, +prelude} .on 'error', gutil.log
s = streamqueue { +objectMode }
.done env, app
.pipe gulp-concat 'app.js'
.pipe gulp-if production, gulp-uglify!
.pipe gulp.dest '_public/js'
gulp.task 'js:vendor' <[bower]> ->
bower = gulp-bower-files!
.pipe gulp-filter -> it.path is /\.js$/
s = streamqueue { +objectMode }
.done bower, gulp.src 'vendor/scripts/*.js'
.pipe gulp-concat 'vendor.js'
.pipe gulp-if production, gulp-uglify!
.pipe gulp.dest '_public/js'
.pipe livereload!
gulp.task 'css' <[bower]> ->
bower = gulp-bower-files!
.pipe gulp-filter -> it.path is /\.css$/
styl = gulp.src './app/styles/**/*.styl'
.pipe gulp-filter -> it.path isnt /\/_[^/]+\.styl$/
.pipe gulp-stylus use: <[nib]>
s = streamqueue { +objectMode }
.done bower, styl, gulp.src 'app/styles/**/*.css'
.pipe gulp-concat 'app.css'
.pipe gulp-if production, gulp-csso!
.pipe gulp.dest './_public/css'
.pipe livereload!
gulp.task 'assets' ->
gulp.src 'app/assets/**'
.pipe gulp.dest '_public'