-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
67 lines (60 loc) · 1.84 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
module.exports = (grunt) ->
require('matchdep').filterAll('grunt-*').forEach grunt.loadNpmTasks
webpack = require('webpack')
webpackConfig = require('./webpack.config.js')
grunt.initConfig
webpack:
options: webpackConfig
build: plugins:
webpackConfig.plugins.concat(
new (webpack.DefinePlugin)('process.env': 'NODE_ENV': JSON.stringify('production')),
new (webpack.optimize.DedupePlugin),
new (webpack.optimize.UglifyJsPlugin))
'build-dev':
devtool: 'sourcemap'
debug: true
'webpack-dev-server':
options:
webpack: webpackConfig
# port: '3300'
# host: "0.0.0.0"
start:
keepAlive: true
webpack:
devtool: 'sourcemap'
debug: true
watch: app:
files: [
'apps/**/*'
'apps/node_modules/**/*'
# 'web_modules/**/*'
]
tasks: [ 'webpack:build-dev' ]
options: spawn: false
copy:
build:
cwd: 'apps/web/'
src: [ '**/*.html', '**/js/*.js', 'css/**' ]
dest: 'build'
expand: true
clean:
build:
src: ['build']
'gh-pages':
src: ['**', '!node_modules', '!.grunt']
options:
base: 'build'
# The development server (the recommended option for development)
grunt.registerTask 'default', [ 'webpack-dev-server:start' ]
# Build and watch cycle (another option for development)
# Advantage: No server required, can run app from filesystem
# Disadvantage: Requests are not blocked until bundle is available,
# can serve an old app on too fast refresh
grunt.registerTask 'dev', [
'webpack:build-dev'
'watch:app'
]
# Production build
grunt.registerTask 'build', ['webpack:build', 'clean:build', 'copy:build']
grunt.registerTask 'publish', ['build', 'gh-pages']
return