-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
103 lines (92 loc) · 2.87 KB
/
Gruntfile.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
generateBrowserifyConf = ({minify, map, watch} = {}) ->
options = {}
files =
'public/assets/application.js': [
'assets/javascripts/**/*.cjsx'
'assets/javascripts/**/*.coffee'
]
options =
transform: ['coffee-reactify', 'brfs']
browserifyOptions:
extensions: ['.coffee']
preBundleCB: (b) ->
if map || minify
b.plugin('minifyify', map: map || false, minify: minify || false)
return b
exclude: ['jquery']
if watch
options.watchifyOptions =
livereload: true
options.watch = true
options.keepAlive = true
{files, options}
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
sass:
dist:
files:
'public/assets/visualizer.css': 'assets/stylesheets/visualizer.sass'
concat:
css:
src: [
'public/assets/visualizer.css'
'node_modules/bootstrap/dist/css/bootstrap.css'
'node_modules/bootstrap-slider/dist/css/bootstrap-slider.css'
]
dest: 'public/assets/application.css'
dist_html:
src: [
'assets/html/intro.html'
'assets/html/dist_head.html'
'assets/html/content_body.html'
'assets/html/outro.html'
]
dest: 'public/index.html'
dev_html:
src: [
'assets/html/intro.html'
'assets/html/dev_head.html'
'assets/html/content_body.html'
'assets/html/outro.html'
]
dest: 'public/index.html'
browserify:
dist: generateBrowserifyConf(minify: true, map: false)
dev: generateBrowserifyConf()
dev_watch: generateBrowserifyConf(watch: true)
concurrent:
options:
logConcurrentOutput: true
dev:
tasks: ["watch", "browserify:dev_watch"]
watch:
sass:
files: ['assets/stylesheets/**/*.sass']
tasks: ['sass', 'concat:css']
app:
files: ['public/assets/application.js', 'public/index.html', 'public/assets/application.css']
tasks: []
options:
livereload: true
'http-server':
dev:
root: 'public'
port: 3700
cache: -1
runInBackground: true
dist:
root: 'public'
port: 3700
cache: 60
runInBackground: false
grunt.loadNpmTasks 'grunt-concurrent'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-sass'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-http-server'
grunt.loadNpmTasks 'grunt-browserify'
grunt.registerTask 'dist', ['sass', 'concat:dist_html', 'concat:css', 'browserify:dist']
grunt.registerTask 'dev', ['sass', 'concat:dev_html', 'concat:css', 'browserify:dev']
grunt.registerTask 'dev_watch', ['sass', 'concat:dev_html', 'concat:css', 'http-server:dev', 'concurrent:dev']
grunt.registerTask 'default', ['dist', 'http-server:dist']