This repository has been archived by the owner on May 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
103 lines (93 loc) · 2.47 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
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
banner: '/* <%= pkg.name %> - v<%= pkg.version %>\n' +
'<%= pkg.homepage ? "" + pkg.homepage + "\\n" : "" %>' +
'Created <%= grunt.template.today("yyyy") %> <%= pkg.author %>; ' +
'Licensed under the <%= _.pluck(pkg.licenses, "type").join(", ") %>\n*/\n',
cssfiles: ["css/*.css", "!css/*.min.css"],
jsfiles: ["js/*.js", "!js/*min.js"],
devUpdate: {
main: {
options: {
// Do not mention already updated dependencies
reportUpdated: false,
// Prompt asking if the dependency should be updated
updateType : "prompt"
}
}
},
copy: {
main: {
expand: true,
cwd: "node_modules/",
src: "jquery.runner/build/*-min.js",
dest: "js/",
flatten: true,
filter: "isFile"
},
},
htmlhint: {
html: {
options: {
"tag-pair": true,
},
src: ["index.html"]
}
},
csslint: {
strict: {
options: {
csslintrc: ".csslintrc",
"import": 2
},
src: "<%= cssfiles %>",
}
},
cssmin: {
add_banner: {
options: {
banner: "<%= banner %>"
},
files: {
"css/style.min.css": "<%= cssfiles %>"
}
}
},
jshint: {
src: {
options: {
jshintrc: ".jshintrc"
},
src: "<%= jsfiles %>",
},
},
uglify: {
options: {
banner: "<%= banner %>"
},
my_target: {
files: {
"js/index.min.js": "<%= jsfiles %>",
}
}
},
watch: {
files: ["Gruntfile.js", "<%= cssfiles %>", "<%= jsfiles %>"],
tasks: ["all"]
}
});
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.registerTask('default', 'List commands', function () {
grunt.log.writeln("");
grunt.log.writeln('Run "grunt lint" to lint the source files');
grunt.log.writeln('Run "grunt build" to minify the source files');
grunt.log.writeln('Run "grunt devUpdate" to update the devDependencies');
grunt.log.writeln('Run "grunt all" to run all tasks except "devUpdate"');
});
grunt.registerTask("lint", ["htmlhint", "csslint", "jshint"]);
grunt.registerTask("build", ["cssmin", "uglify"]);
grunt.registerTask("all", ["lint", "build"]);
grunt.option("force", true);
};