-
Notifications
You must be signed in to change notification settings - Fork 6
/
Gruntfile.js
executable file
·133 lines (121 loc) · 3.07 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
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
/* LESS compiling */
less: {
development: {
files: [
/* Compile components' less stylesheets */
{
expand: true, // Enable dynamic expansion.
cwd: './css', // Src matches are relative to this path.
src: ['**/style.less'], // Actual pattern(s) to match.
dest: './css', // Destination path prefix.
ext: '.css' // Dest filepaths will have this extension.
}
]
}
},
/* CSS minify */
cssmin: {
options: {
shorthandCompacting: false,
roundingPrecision: -1
},
target: {
files: {
'./css/style.min.css': ['./css/style.css']
}
}
},
/*JS Concat*/
concat: {
all: {
src: ['./jsapp/lib/**.js', './jsapp/plugins/**.js', './jsapp/layout/**.js', './jsapp/pages/**.js', './jsapp/**.js'],
dest: "./js/script.js"
}
},
/* JS minify */
uglify: {
my_target: {
files: {
'./js/script.min.js': ['./js/script.js']
}
}
},
svg_sprite: {
basic: {
expand : true,
cwd : 'images',
src : ['svg/**.svg'],
dest : '',
options : {
mode : {
css : { // Activate the �css� mode
render : {
less : true // Activate CSS output (with default options)
}
}
},
shape: {
spacing: {
padding: 1
}
}
}
}
},
sprite:{
all: {
src: 'images/sprites/*.png',
dest: 'images/iconset.png',
destCss: 'css/_iconset.less'
}
},
/* Watching for changes in project directory */
watch: {
/* Watching for .less files changes */
less: {
files: [
'./css/**/**.less'
],
tasks: ['less:development', 'cssmin'],
options: {
reload: true
}
},
js: {
files: [
'./jsapp/**/**.js'
],
tasks: ['concat', 'uglify'],
options: {
reload: true
}
}
},
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
'dist/app.js': 'src/app.js'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-concat-css');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-svg-sprite');
grunt.loadNpmTasks('grunt-spritesmith');
grunt.registerTask('default', ['less', 'cssmin', 'concat', 'uglify', 'watch']);
grunt.registerTask('build', ['less', 'watch']);
grunt.registerTask('svg', ['svg_sprite']);
};