記一個 GruntJS 與 Makefile 的設定檔


因為不想將 GruntJS 安裝到全局環境中.
所以每次用起上來都必須輸入完整路徑.
簡單一點是通過 .bash_profile 解決.
但考慮到可能會在不同機器上開發.所以參上 Makefile
直接 make assets 就好了

1
2
assets:
node_modules/grunt-cli/bin/grunt -d
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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';',
stripBanners: true
},
dist: {
src: [
"static/vendor/jquery.js",
"static/vendor/angular.js",
"static/vendor/html5shiv.js",
"static/vendor/angular-breadcrumb/breadcrumb.js",
"static/js/default.js"
],
dest: "static/assets/default.js"
}
},
uglify: {
options: {
},
dist: {
files: {
'static/assets/default.js': 'static/assets/default.js'
}
}
},
cssmin: {
options: {
keepSpecialComments: 0
},
compress: {
files: {
'static/assets/default.css': [
"static/vendor/bootstrap/css/bootstrap.min.css",
"static/vendor/flat-ui/css/flat-ui.css",
"static/vendor/fort-awesome/css/font-awesome.min.css",
"static/vendor/bootstrap/css/bootstrap-responsive.min.css",
"static/css/default.css"
]
}
}
}
});

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['concat', 'uglify', 'cssmin']);
}