This repository has been archived by the owner on Oct 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
130 lines (113 loc) · 4.59 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
module.exports = function (grunt) {
// Displays the elapsed execution time of grunt tasks
require('time-grunt')(grunt);
// Load NPM Tasks
require('load-grunt-tasks')(grunt, ['grunt-*', '!grunt-template-jasmine-istanbul', '!grunt-template-jasmine-requirejs']);
// Project configuration.
grunt.initConfig({
// Store your Package file so you can reference its specific data whenever necessary
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
mangle: false,
beautify: false,
compress: false
},
static_mappings: {
// Because these src-dest file mappings are manually specified, every
// time a new file is added or removed, the Gruntfile has to be updated.
files: {
'assets_min/js/admin.js': [
'assets/js/vendor/jquery.js',
'assets/js/bootstrap/affix.js',
'assets/js/bootstrap/alert.js',
'assets/js/bootstrap/button.js',
'assets/js/bootstrap/carousel.js',
'assets/js/bootstrap/collapse.js',
'assets/js/bootstrap/dropdown.js',
'assets/js/bootstrap/tab.js',
'assets/js/bootstrap/transition.js',
'assets/js/bootstrap/scrollspy.js',
'assets/js/bootstrap/modal.js',
'assets/js/bootstrap/tooltip.js',
'assets/js/bootstrap/popover.js',
'assets/js/admin.js'],
'assets_min/js/frontend.js': [
'assets/js/vendor/jquery.js',
'assets/js/vendor/jquery.easings.min.js',
'assets/js/vendor/jquery.slimscroll.min.js',
'assets/js/vendor/jquery.fullpage.min.js',
'assets/js/vendor/jquery.form.js',
'assets/js/vendor/featherlight.js',
'assets/js/vendor/featherlight.gallery.js',
'assets/js/frontend.js'
]
}
}
},
sass: {
dist: {
options: {
style: 'compressed',
compass: 'true',
sourcemap: true,
lineNumbers: true,
require: ['bootstrap-sass']
},
files:{
'assets_min/css/admin.css' : 'assets/sass/admin.scss',
'assets_min/css/styles.css' : 'assets/sass/styles.scss',
'assets_min/css/tumblr.css' : 'assets/sass/tumblr.scss'
}
},
frontend: {
options: {
style: 'expanded',
compass: 'true',
sourcemap: true,
lineNumbers: true,
},
files:{
'assets_min/css/styles.css' : 'assets/sass/styles.scss'
}
}
},
// Run: `grunt watch` from command line for this section to take effect
watch: {
js : {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'uglify']
},
css : {
files: ['<%= sass.dist.files %>'],
tasks: 'sass:dist'
}
},
concurrent: {
options: {
logConcurrentOutput: true
},
prod: {
tasks: ["watch:js", "watch:css"]
},
dev: {
tasks: ["watch:js", "watch:css"]
}
}
});
// Default Task
grunt.registerTask('default', ['uglify', 'sass:frontend']);
grunt.registerTask("dev", ["concurrent:dev"]);
// Release Task
grunt.registerTask('release', ['uglify', 'sass:dist']);
/*
Notes:
When registering a new Task we can also pass in any other registered Tasks.
e.g. grunt.registerTask('release', 'default requirejs'); // when running this task we also run the 'default' Task
We don't do this above as we would end up running `sass:dev` when we only want to run `sass:dist`
We could do it and `sass:dist` would run afterwards, but that means we're compiling sass twice which (although in our example quick) is extra compiling time.
To run specific sub tasks then use a colon, like so...
grunt sass:dev
grunt sass:dist
*/
};