-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathGruntfile.js
117 lines (113 loc) · 3.77 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
114
115
116
117
module.exports = function(grunt) {
var cli = grunt.cli;
cli.optlist.beautify = {
"short": "B",
info: "Set beautify on",
type: String
};
grunt.initConfig({
watch: {
'analytics': {
files: [ 'grunt/js/**/*.js', 'grunt/sass/**/*.*', 'Gruntfile.js' ],
tasks: ['jshint','requirejs','compass', 'jekyll:build']
},
'jekyll': {
files: [ '_includes/**/*', '_layouts/**/*', '_data/**/*', '*.html', '_config.yml', 'test/**/*' ],
tasks: ['jekyll:build']
}
},
clean: {
analytics: ['lib/*.*']
},
jshint: {
analytics: ['grunt/js/analytics.js',
'grunt/js/core/config.js','grunt/js/core/track-click.js','grunt/js/core/track-page.js',
'grunt/js/utils/logger.js','grunt/js/utils/polyfill.js'],
others: ['Gruntfile.js'],
options: {
"globals": {
document: false,
window: false,
console: false,
setTimeout: false,
clearTimeout: false,
setInterval: false,
clearInterval: false
}
}
},
compass: {
dist: {
options: {
sassDir: 'grunt/sass/',
cssDir: 'dist/css/',
outputStyle: grunt.option('beautify') ? "expanded" : "compressed" ,
noLineComments: true,
trace: true
}
}
},
requirejs:{
analytics: {
options: {
optimize: grunt.option('beautify') ? "none" : "uglify2",
preserveLicenseComments: false,
baseUrl: "grunt/js",
dir: "dist/js",
removeCombined: true,
generateSourceMaps: false,
modules:[{
name: 'analytics'
},{
name: 'demo'
}]
}
}
},
mocha: {
all: {
src: (function() {
return ['_site/test.html', '_site/test/unit/omniture.html'];
}()),
options: {
run: false,
log: true // Set to true to see console.log() output on the terminal
}
}
},
jekyll: { // Task
options: { // Universal options
bundleExec: true,
config: '_config.yml'
},
build:{
options: {
watch: false,
serve: false
}
},
run:{
options: {
watch: true,
serve: true
}
}
},
exec: {
rakeFunctional: {
command: 'rake functional'
}
}
});
// Loading dependencies
for (var key in grunt.file.readJSON("package.json").devDependencies) {
if (key !== "grunt" && key.indexOf("grunt") === 0) {
grunt.loadNpmTasks(key);
}
}
grunt.registerTask('default', ['clean', 'jshint', 'requirejs', 'compass', 'jekyll:build']);
grunt.registerTask('spy', ['clean', 'jshint', 'requirejs', 'compass', 'jekyll:build', 'watch']);
grunt.registerTask('hint', ['jshint']);
grunt.registerTask('testjs', ['requirejs', 'compass', 'jekyll:build','mocha']);
grunt.registerTask('test', ['testjs', 'exec:rakeFunctional']);
};