-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
145 lines (143 loc) · 4.3 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* jslint node: true */
module.exports = function(grunt) {
// configure the tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
build: [
'build/',
'./<%= pkg.name %>.v.<%= pkg.version %>.zip'
],
afterBuild: [
'.tmp/'
]
},
copy: {
build: {
files: [
{expand: true, src: ['fonts/*'], dest: 'build/', filter: 'isFile'},
{expand: true, src: ['images/**'], dest: 'build/'},
{src: ['package.json'], dest: 'build/'},
{src: ['*.html'], dest: 'build/'},
{src: ['ReadMe.md'], dest: 'build/'},
{src: ['ChangeLog.md'], dest: 'build/'},
{src: ['js/html5shiv.js', 'js/respond.min.js'], dest: 'build/'}
]
}
},
'useminPrepare': {
html: [
'index.html'
],
options: {
dest: 'build/',
staging: '.tmp/',
root: '.'
}
},
usemin: {
options: {
dirs: ['build/']
},
html: ['build/*.html']
},
uglify: {
generated: {
options: {
preserveComments: 'some'
}
}
},
compass: {
/* remove cache before building */
clean: {
options: {
config: 'config.rb',
clean: true
}
},
/* build SASS */
build: {
options: {
config: 'config.rb',
outputStyle: 'compact',
debugInfo: false,
noLineComments: true
}
}
},
compress: {
build: {
options: {
archive: 'build/<%= pkg.name %>.v.<%= pkg.version %>.min.zip'
},
files: [
{expand: true, src: ['**/*', '!<%= pkg.name %>.v.*.zip'], cwd: 'build/'} // includes all files from the build path except the archive itself
]
}
},
jshint: {
src: [
/* 3rd party scripts are not included here */
'Gruntfile.js',
'js/jquery.mediaQueryBreakDetector.js',
'js/jquery.extractCoordinateFromMouseEvent.js',
'js/jquery.equalizeHeights.js',
'js/jquery.gentlyScrollTo.js'
],
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
undef: true,
browser: true,
jquery: true,
'-W099': true, /* switching off "W099: Mixed spaces and tabs." */
globals: {
/* specify missing globals here, if any */
brightcove: true
}
}
}
});
// load the tasks
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-usemin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-w3c-validation');
grunt.loadNpmTasks('grunt-run-grunt');
// define the tasks
grunt.registerTask(
'build',
'Scans html files for scripts and css blocks to adjust the config and build the files.',
[
'useminPrepare',
'concat',
'uglify',
'cssmin',
'usemin',
'clean:afterBuild'
]
);
grunt.registerTask(
'default',
'Compiles the Project',
[
'jshint',
'clean',
'compass',
'copy',
'build',
'compress'
]
);
};