This repository was archived by the owner on Mar 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGruntfile.js
More file actions
119 lines (107 loc) · 2.82 KB
/
Gruntfile.js
File metadata and controls
119 lines (107 loc) · 2.82 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
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
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 2013-<%= grunt.template.today('yyyy') %> <%= pkg.author %>\n" +
" * Licensed under the <%= pkg.license %>\n */\n",
devUpdate: {
main: {
options: {
reportUpdated: false,
updateType: "prompt",
packages: {
devDependencies: true,
dependencies: true
}
}
}
},
copy: {
main: {
files: [
{
expand: true,
flatten: true,
cwd: "node_modules/",
src: ["perfect-scrollbar/min/perfect-scrollbar.min.css",
"perfect-scrollbar/min/perfect-scrollbar.min.js"],
dest: "lib/"
}
]
}
},
htmlhint: {
html: {
options: {
"tag-pair": true
},
src: ["index.html"]
}
},
csslint: {
strict: {
options: {
csslintrc: ".csslintrc",
"import": 2
},
src: "css/style.css"
}
},
cssmin: {
add_banner: {
options: {
banner: "<%= banner %>"
},
files: {
"css/<%= pkg.name %>.min.css": ["css/style.css"]
}
}
},
jshint: {
files: ["js/*.js", "!js/*.min.js"],
options: {
globals: {
jQuery: true
}
}
},
uglify: {
options: {
banner: "<%= banner %>",
compress: {
drop_console: true
},
mangle: true,
report: "min",
sourceMap: false
},
my_target: {
files: {
"js/newsfeed.min.js": "js/newsfeed.js"
}
}
},
// Watched files to trigger grunt
watch: {
files: ["package.json", "index.html", "css/style.css", "<%= jshint.files %>"],
tasks: ["all"]
}
});
// Load all the plugins required to perform our tasks
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"');
});
// Define the tasks
grunt.registerTask("lint", ["htmlhint", "csslint", "jshint"]);
grunt.registerTask("build", ["cssmin", "uglify", "copy"]);
grunt.registerTask("all", ["lint", "build"]);
// Always use --force to stop csslint from killing the task
grunt.option("force", true);
};