-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
113 lines (113 loc) · 3.11 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
"use strict";
//var dom = require("node-dom").dom;
module.exports = function(grunt) {
//var html = dom(grunt.file.read("src/index.html"));
grunt.initConfig({
pkg : grunt.file.readJSON("package.json"),
jshint : {
options : {jshintrc : true},
src : [ "src/**/*.js", "!src/js/libs/*.js" ]
},
jsonlint : {
src : [
".jsbeautifyrc",
".jshintrc",
"src/config.json.sample",
"*.json",
"src/**/*.json"
]
},
jsbeautifier : {
options : {
config : ".jsbeautifyrc",
js : {fileTypes : [ ".js", ".json" ]},
css : {fileTypes : [ ".less", ".css" ]},
html : {fileTypes : [".html"]}
},
files : [
"src/**/*.js",
"src/**/*.json",
"!src/js/libs/*.js",
"src/**/*.html",
"!src/templates/*.html",
"src/**/*.less",
"src/**/*.css"
]
},
uglify : {
options : {screwIE8 : true, compress : true},
files : {
"dist/syteup.min.js" : "dist/syteup.js",
"dist/syteup-modules.min.js" : "dist/syteup-modules.js",
"dist/syteup-libs.min.js" : "dist/syteup-libs.js"
}
},
less : {
options : {
ieCompat : false,
strictMath : true,
strictImports : true,
strictUnits : true,
rootpath : "src/",
compress : true,
plugins : [new require("less-plugin-clean-css")()]
},
files : {
"dist/syteup.min.css" : "src/less/styles.less",
"dist/syteup-profiles.min.css" : "src/less/profiles.less"
}
},
htmlmin : {
options : {
removeComments : true,
collapseWhitespace : true,
preserveLineBreaks : true,
removeAttributeQuotes : true,
removeRedundantAttributes : true,
useShortDoctype : true,
keepClosingSlash : true,
minifyJS : true,
minifyCSS : true
},
files : {"dist/index.html" : "src/index.html"}
},
copy : {
files : {
"src/templates/" : "dist/templates",
"src/services/" : "dist/services",
"src/plugins/" : "dist/plugins",
"src/blogs/" : "dist/blogs",
"src/imgs/" : "dist/imgs",
"src/config.json" : "dist/config.json"
}
},
concat : {
files : {
"dist/syteup.js" : [ "src/js/*.js", "src/blogs/*.js" ],
"dist/syteup-modules.js" : [ "src/plugins/*.js", "src/services/*.js" ],
"dist/syteup-libs.js" : [/********/]
}
},
clean : {src : "dist/"}
});
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-jsonlint");
grunt.loadNpmTasks("grunt-jsbeautifier");
grunt.loadNpmTasks("grunt-contrib-htmlmin");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.registerTask("default", [
/*"clean",*/ "jshint",
"jsonlint",
"jsbeautifier",
"concat",
"copy",
"uglify",
"less",
"htmlmin"
]);
};