This repository was archived by the owner on Apr 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGruntfile.js
More file actions
104 lines (93 loc) · 2.75 KB
/
Gruntfile.js
File metadata and controls
104 lines (93 loc) · 2.75 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
96
97
98
99
100
101
102
103
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
clean: ['src/main/webapp/resources/base/js/build/'],
// Compile JSX files to build/ folder
react: {
options: {
transform: [ require('grunt-react').browserify ]
},
compile:
{
expand: true, // enable Dynamic expansion
cwd: 'src/main/webapp/resources/base/js/source',
src: ['*/*.react.js','*.react.js'],
dest: 'src/main/webapp/resources/base/js/build/',
ext: '.react.js'
}
},
uglify: {
options: {
compress: true,
mangle: true
},
concat: {
files: [
{
src: ['src/main/webapp/resources/base/js/build/components/*.react.js'], // source files mask
dest: 'src/main/webapp/resources/base/js/build/components/components.react.min.js'
},
{
src: ['src/main/webapp/resources/base/js/build/mixin/*.react.js'], // source files mask
dest: 'src/main/webapp/resources/base/js/build/mixin/mixin.react.min.js'
}
]
},
only_minify: {
files: [
{
expand: true,
cwd: 'src/main/webapp/resources/base/js/build/admin',
src: '*.react.js',
dest: 'src/main/webapp/resources/base/js/build/admin',
ext: '.react.min.js',
},
{
expand: true,
cwd: 'src/main/webapp/resources/base/js/build/menu',
src: '*.react.js',
dest: 'src/main/webapp/resources/base/js/build/menu',
ext: '.react.min.js',
}
]
}
},
cssmin: {
options: {
shorthandCompacting: false,
roundingPrecision: -1
},
target: {
files: {
'src/main/webapp/resources/base/app.min.css': [
'src/main/webapp/resources/base/*/*.css',
'src/main/webapp/resources/base/*.css',
'src/main/webapp/resources/base/css/!*.min.css',
'src/main/webapp/resources/base/!*.min.css'
]
}
}
},
watch: {
react: {
files: ['src/main/webapp/resources/base/js/source/*/*.react.js','src/main/webapp/resources/base/js/source/*.react.js'],
tasks: ['react'],
options: {
spawn: false
}
}
}
});
grunt.event.on('watch', function(action, filepath) {
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-react');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task.
grunt.registerTask('default', ['react']);//, 'uglify', 'cssmin', 'clean',
};