forked from AngryLoki/wikidata-graph-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.coffee
More file actions
95 lines (81 loc) · 2.81 KB
/
gulpfile.coffee
File metadata and controls
95 lines (81 loc) · 2.81 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
gulp = require 'gulp'
gulpLoadPlugins = require 'gulp-load-plugins'
browserSync = require('browser-sync').create()
es = require 'event-stream'
$ = gulpLoadPlugins()
log = require 'fancy-log'
production = !!$.util.env.production
gulp.task 'browser-sync', ->
browserSync.init server: baseDir: './dist'
return
gulp.task 'serve', ->
browserSync.init server: './dist'
gulp.watch 'src/assets/stylesheets/*.styl', [ 'css' ]
gulp.watch 'src/assets/scripts/*.js', [ 'js' ]
gulp.watch 'src/assets/scripts/*.coffee', [ 'js' ]
gulp.watch 'src/*.jade', [ 'templates' ]
return
# Build tasks
gulp.task 'bower-css', ->
gulp.src([
'bower_components/**/*.min.css'
'!bower_components/angular-material/modules/**/*.min.css'
'!bower_components/angular-material/layouts/**/*.min.css'
'!bower_components/angular-material/core/**/*.min.css'
])
.pipe $.flatten()
.pipe gulp.dest 'dist/assets/css/'
gulp.task 'bower-js', ->
gulp.src([
'bower_components/**/*.min.js'
'bower_components/**/color-hash.js'
'!bower_components/angular-material/modules/**/*.min.js'
])
.pipe $.flatten()
.pipe gulp.dest 'dist/assets/js/'
gulp.task 'bower-fonts', ->
gulp.src([
'bower_components/**/dist/fonts/*.eot'
'bower_components/**/dist/fonts/*.svg'
'bower_components/**/dist/fonts/*.ttf'
'bower_components/**/dist/fonts/*.woff'
'bower_components/**/dist/fonts/*.woff2'
])
.pipe $.flatten()
.pipe gulp.dest 'dist/assets/fonts/'
gulp.task 'bower-all', ['bower-css', 'bower-js', 'bower-fonts']
gulp.task 'css', ->
gulp.src 'src/assets/stylesheets/*.styl'
.pipe $.stylus()
.pipe $.autoprefixer()
.pipe if production then $.csso() else $.util.noop()
.pipe gulp.dest 'dist/assets/css/'
.pipe browserSync.stream()
gulp.task 'js', ->
es.merge(gulp.src('src/assets/scripts/*.coffee')
.pipe($.coffee()), gulp.src('src/assets/scripts/*.js'))
.pipe if production
$.sourcemaps.init()
.pipe $.uglify()
.pipe $.concat 'all.min.js'
.on('error', log)
.pipe $.sourcemaps.write('./')
else $.util.noop()
.pipe gulp.dest 'dist/assets/js/'
.pipe browserSync.stream()
gulp.task 'templates', ->
gulp.src 'src/*.jade'
.pipe $.jade pretty: true
.pipe if production then $.htmlmin(collapseWhitespace: true) else $.util.noop()
.pipe gulp.dest 'dist/'
.pipe browserSync.stream()
gulp.task 'bower', -> $.bower()
gulp.task 'deploy', ->
ghToken = process.env.GH_TOKEN
ghRef = process.env.GH_REF
conf = remoteUrl: "https://#{ghToken}@#{ghRef}" if ghToken and ghRef
gulp.src './dist/**/*'
.pipe $.ghPages conf
# User tasks
gulp.task 'build', ['bower-all', 'js', 'css', 'templates']
gulp.task 'default', ['build', 'serve']