-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
54 lines (52 loc) · 1.46 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
/**
* Grunt Configuration which have following components:
* 1) 'babel' -> This is the main task which transforms JSX to JS. You can add any number of tasks in this.
* 2) 'watch' -> This is task which watches the babel task for any modifications.
* 3) 'concurrent' -> This task allows us to run all the 'watch' task concurrently.
*/
module.exports = function( grunt ) {
require('load-grunt-tasks')(grunt)
grunt.initConfig( {
babel : {
options : {
plugins : ['transform-react-jsx'],
presets: ['es2015', 'react']
},
//Commom Components which will be shared b/w client & server
common : {
expand : true,
cwd : './react_demo/cartridge/scripts/jsx/common',
src : ['*.jsx'],
dest : './react_demo/cartridge/static/default/react/components',
ext : '.js'
},
//Pure server side components. Mainly static
server : {
expand : true,
cwd : './react_demo/cartridge/scripts/jsx/server',
src : ['*.jsx'],
dest : './react_demo/cartridge/scripts/react-js-views',
ext : '.js'
}
},
watch: {
common: {
files: './react_demo/cartridge/scripts/jsx/common/*.jsx',
tasks: ['babel:common']
},
server: {
files: './react_demo/cartridge/scripts/jsx/server/*.jsx',
tasks: ['babel:server']
}
},
concurrent: {
transform: {
tasks: ['watch:common', 'watch:server'],
options: {
logConcurrentOutput: true
}
}
}
} );
grunt.registerTask('default', ['concurrent:transform']);
};