-
Notifications
You must be signed in to change notification settings - Fork 18
/
Gruntfile.js
145 lines (132 loc) · 3.62 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
module.exports = function(grunt){
// Load The Plugins
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-csscomb');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
// required for sass/scss
require('load-grunt-tasks')(grunt);
// Configure main project settings
grunt.initConfig({
// basic settings and info about our plugins
pkg: grunt.file.readJSON('package.json'),
// copy some files from bower components to dist folders
copy: {
main: {
files: [
{
cwd: 'bower_components/bootstrap/dist/css/',
src: 'bootstrap.min.css',
dest: 'main/css/src/',
expand: true
},
{
cwd: 'bower_components/jquery/dist/',
src: 'jquery.js',
dest: 'main/js/src/',
expand: true
},
{
cwd: 'bower_components/bootstrap/dist/js/',
src: 'bootstrap.js',
dest: 'main/js/src/',
expand: true
},
{
cwd: 'bower_components/Chart.js/dist/',
src: 'Chart.min.js',
dest: 'main/js/src/',
expand: true
},
{
cwd: 'bower_components/tether/dist/js/',
src: 'tether.min.js',
dest: 'main/js/src/',
expand: true
},
{
cwd: 'bower_components/datatables.net/js/',
src: 'jquery.dataTables.min.js',
dest: 'main/js/src/',
expand: true
},
{
cwd: 'bower_components/datatables.net-dt/css/',
src: 'jquery.dataTables.min.css',
dest: 'main/css/src/',
expand: true
},
{
cwd: 'bower_components/datatables.net-dt/images/',
src: '**/*',
dest: 'main/css/images/',
expand: true
},
]
}
},
// CSS with superpowers
sass: {
dist: {
files: {
'main/css/src/main.css': 'main/sass/main.scss'
}
}
},
// make our css beautiful
csscomb: {
dist: {
options: {
config: 'csscomb.json'
},
files: {
'main/css/src/main.css': ['main/css/src/main.css']
}
}
},
// minify and combine our css files
cssmin: {
combine: {
files: {
'main/css/dist/all.styles.min.css':
[
'main/css/src/bootstrap.min.css',
'main/css/src/jquery.dataTables.min.css',
'main/css/src/main.css'
]
}
}
},
// minify and combine our javascript
uglify: {
combine: {
files: {
'main/js/dist/all.scripts.min.js':
[
'main/js/src/jquery.js',
'main/js/src/tether.min.js',
'main/js/src/bootstrap.js',
'main/js/src/Chart.min.js',
'main/js/src/jquery.dataTables.min.js',
'main/js/src/main.js'
]
}
}
},
// watch files for changes and run tasks when they change
watch: {
scripts: {
files: ['main/sass/*.scss', 'main/css/src/*.css', 'main/js/src/*.js', 'Gruntfile.js'],
tasks: ['copy', 'sass', 'csscomb', 'cssmin', 'uglify'],
options: {
spawn: false,
event:['all']
}
}
}
});
// Do the task
grunt.registerTask('default', ['copy', 'sass', 'csscomb', 'cssmin', 'uglify', 'watch']);
grunt.registerTask('build', ['copy', 'sass', 'csscomb', 'cssmin', 'uglify']);
};