-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgruntfile.js
143 lines (120 loc) · 2.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
module.exports = function ( grunt ) {
'use strict';
// ================================================================
// CONFIG TASKS
// ================================================================
// Define the configuration
grunt.initConfig({
// Specifics of npm's package.json handling
pkg: grunt.file.readJSON( 'package.json' ),
// Banner
banner:
'/*!\n'+
' * Milligram v<%= pkg.version %>\n'+
' * <%= pkg.homepage %>\n'+
' *\n'+
' * Copyright (c) '+new Date().getFullYear()+' CJ Patoilo\n'+
' * Licensed under the <%= pkg.license %> license\n'+
'*/\n\n',
// DEFAULT TASK
// ================================================================
// Watch files and process the above tasks
watch: {
options: {
livereload: false
},
grunt: {
files: [
'gruntfile.js'
],
options: {
reload: true
}
},
postcss: {
files: [
'src/**/*.css'
],
tasks: [
'postcss',
'cssnano'
]
}
},
// BUILD TASKS
// ================================================================
// Clear files and folders
clean: {
all: [
'dist'
],
css: [
'dist/**/*.css',
'dist/**/*.map'
]
},
// Compile CSS files with POSTCSS CSSNEXT
postcss: {
options: {
map: {
inline: false, // save all sourcemaps as separate files...
annotation: 'dist/' // ...to the specified directory
},
processors: [
require("postcss-import")(),
require('postcss-cssnext')()
]
},
dest: {
files: {
'dist/milligram.css': 'src/milligram.css'
}
}
},
cssnano: {
options: {
sourcemap: false,
safe: true
},
dist: {
files: {
'dist/milligram.min.css': 'dist/milligram.css'
}
}
},
// Copy files and folders.
copy: {
all: {
files: [{
expand: true,
cwd: 'src',
src: '**',
dest: 'dist'
}]
}
}
});
// ================================================================
// REGISTER TASKS
// ================================================================
// Default task
grunt.registerTask( 'default', [
'build',
'watch'
]);
// Build task
grunt.registerTask( 'build', [
'clean:all',
'postcss',
'cssnano',
'clean:css',
'copy'
]);
// ================================================================
// LOAD TASKS
// ================================================================
// Automatically loading Grunt tasks
require( 'load-grunt-tasks' )( grunt );
// Display the elapsed execution time of Grunt tasks
require( 'time-grunt' )( grunt );
};