-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgruntfile.js
More file actions
71 lines (70 loc) · 1.77 KB
/
gruntfile.js
File metadata and controls
71 lines (70 loc) · 1.77 KB
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
/* global module:true*/
module.exports = function(grunt) {
'use strict';
var LIVERELOAD_PORT = 12345;
var timestamp = Date.now(); // Used to cachebust the sprite image.
grunt.initConfig({
// server used for livereload
connect: {
server: {
options: {
hostname: '*',
base: 'app',
livereload: LIVERELOAD_PORT
}
}
},
// running `grunt less` will compile once
less: {
development: {
options: {
paths: ["./less"],
yuicompress: false
},
files: {
"./css/style.css": "./less/style.less",
"./css/editor.css": "./less/editor.less",
"./css/ie.css": "./less/ie.less"
}
},
},
sprite: {
all: {
src: 'images/sprites/*.png',
destImg: 'images/sprites.png',
destCSS: 'less/sprites.less',
cssFormat: 'less',
cssOpts: {
cssClass: function (item) {
return '.' + item.name + timestamp;
}
}
}
},
// running `grunt watch` will watch for changes
watch: {
options: {
livereload: LIVERELOAD_PORT
},
// Watch less files and run "less" on changes
less: {
files: "./less/*.less",
tasks: ["less"]
},
// Watch template files, only used to reload page on template changes
template: {
files: "./**/*.tpl"
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-spritesmith');
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['less', 'sprite']);
grunt.registerTask('server', [
'connect',
'watch'
]);
};