forked from viastudio/Silencio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
96 lines (89 loc) · 3.17 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
/*global module:false*/
module.exports = function (grunt) {
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// JavaScript Minifier. Add your files to be minified in the src array.
uglify: {
build: {
src: [
'/res/components/jquery/dist/jquery.js',
'res/components/bootstrap/dist/js/bootstrap.js',
'res/components/fitvids/jquery.fitvids.js',
'res/js/global.js'
],
dest: 'res/build/global.min.js'
},
respond: {
src: ['res/components/respond/dest/respond.src.js'],
dest: 'res/build/respond.min.js'
}
},
// CSS Minifier. Add your files to be minified in the src array.
cssmin: {
build: {
src: [
'res/components/bootstrap/dist/css/bootstrap.css',
'res/components/font-awesome/css/font-awesome.css',
'res/css/typography.css',
'res/css/layout.css'
],
dest: 'res/build/global.min.css'
}
},
/* Compiles LESS files in res/less. Uses grunt's glob expansion to get everything in the dir.
* You won't need to update this when you add a new file. */
less: {
dev: {
files: [
{
expand: true,
cwd: 'res/less/',
src: ['*.less'],
dest: 'res/.tmp/css/',
ext: '.css'
}
]
}
},
// Add vendor prefixed styles
postcss: {
options: {
map: false,
processors: [
require('autoprefixer')({browsers: ['last 2 versions']})
]
},
dev: {
files: [
{
expand: true,
cwd: 'res/.tmp/css/',
src: ['*.css'],
dest: 'res/css/',
ext: '.css'
}
]
}
},
// Contains tasks to run when grunt watch is invoked. Whenever any of the files specified are modified, executes tasks specified.
watch: {
less: {
files: 'res/less/**/*.less',
tasks: 'less:dev'
},
autoprefixer: {
files: 'res/.tmp/css/*.css',
tasks: 'postcss:dev'
}
}
});
// Load plugins. Run npm install in the theme root to install these according to package.json
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task - executes when you run grunt in the theme root.
grunt.registerTask('default', ['less:dev', 'postcss:dev', 'uglify', 'cssmin']);
};