This repository has been archived by the owner on Nov 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Gruntfile.js
80 lines (75 loc) · 2.35 KB
/
Gruntfile.js
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
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var webpack = require('webpack');
module.exports = function (grunt) {
grunt.initConfig({
clean: ['./build', './lib'],
babel: {
dist: {
files: [{
expand: true,
cwd: 'lib',
src: ['src/**.jsx', 'src/**.js', 'src/**.json'],
dest: 'lib',
ext: '.js'
}]
}
},
concurrent: {
dev: ['nodemon:dev', 'webpack:dev'],
options: {
logConcurrentOutput: true
}
},
nodemon: {
dev: {
script: './server.js',
options: {
ignore: ['build/**'],
ext: 'js,jsx'
}
}
},
webpack: {
dev: {
resolve: {
extensions: ['', '.js', '.jsx']
},
entry: './index.jsx',
output: {
filename: 'bundle_output.js',
publicPath: 'http://localhost:8090/assets'
},
module: {
loaders: [
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.json/, loader: 'json-loader' },
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins: [
new webpack.NormalModuleReplacementPlugin(/^react?$/, require.resolve('react')),
],
stats: {
colors: true
},
devtool: 'source-map',
watch: true,
keepalive: true
}
}
});
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-babel');
grunt.registerTask('default', ['clean', 'concurrent:dev']);
};