-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.coffee
80 lines (69 loc) · 2.3 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
76
77
78
79
80
del = require 'del'
gulp = require 'gulp'
gutil = require 'gulp-util'
concat = require 'gulp-concat'
coffeelint = require 'gulp-coffeelint'
coffeeCompiler = require 'gulp-coffee'
templateCache = require 'gulp-angular-templatecache'
rename = require 'gulp-rename'
sass = require 'gulp-sass'
runSequence = require 'run-sequence'
streamqueue = require 'streamqueue'
buildDir = 'dist'
moduleName = 'gi.ui'
modulePath = 'gi-ui'
coffee = () ->
gulp.src(['client/index.coffee', 'client/**/*.coffee'])
.pipe(coffeelint())
.pipe(coffeelint.reporter())
.pipe(coffeeCompiler {bare: true}).on('error', gutil.log)
templates = () ->
gulp.src('client/views/*.html')
.pipe(templateCache({module: moduleName}))
libs = () ->
gulp.src([
'angular-ui-select/dist/select.js'
'angular-bootstrap/ui-bootstrap-tpls.js'
'ng-file-upload/ng-file-upload-shim.js'
'ng-file-upload/ng-file-upload.js'
'ng-sortable/dist/ng-sortable.js'
'rangy/rangy-core.js'
'rangy/rangy-selectionsaverestore.js'
'textAngular/src/textAngular.js'
'textAngular/src/textAngular-sanitize.js'
'textAngular/src/textAngularSetup.js'
'ngprogress/build/ngProgress.js'
'spin.js/spin.js'
'angular-spinner/angular-spinner.js'
'angular-ui-tree/dist/angular-ui-tree.js'
], {cwd:'bower_components/'})
gulp.task 'clean', (cb) ->
del buildDir, cb
gulp.task 'styles', (cb) ->
gulp.src('client/scss/*.scss')
.pipe(sass())
.pipe(gulp.dest(buildDir))
cb()
gulp.task 'fonts', () ->
gulp.src([
'bower_components/font-awesome/fonts/*'
'bower_components/bootstrap-sass/assets/fonts/bootstrap/*'
])
.pipe(gulp.dest(buildDir + '/fonts'))
gulp.task 'build', ['styles', 'fonts'], () ->
streamqueue({objectMode: true}, libs(), coffee(), templates())
.pipe(concat(modulePath + '.js'))
.pipe(gulp.dest(buildDir))
gulp.task 'moveCSS', () ->
gulp.src([
'bower_components/angular-ui-select/dist/select.css'
'bower_components/textAngular/src/textAngular.css'
'bower_components/ng-sortable/dist/ng-sortable.style.css' ])
.pipe(rename({prefix: '_', extname: '.scss'}))
.pipe(gulp.dest('client/scss'))
gulp.task 'default', (cb) ->
runSequence 'clean', 'moveCSS', 'build', cb
gulp.task 'watch', ['build'], () ->
gulp.watch(['client/views/*.html'
'client/**/*.coffee']
['build'])