This repository has been archived by the owner on Aug 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
114 lines (107 loc) · 3.42 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
module.exports = function(grunt) {
grunt.initConfig({
watch: {
all: {
options: {
livereload: true
},
files: [
'*.html',
'src/*.html',
'examples/**/*.html',
'tests/*.js',
'tests/*.html',
'tests/**/*.html'
],
// tasks: ['jshint'],
},
},
replace: {
example: {
src: ['src/*',".bowerrc"],
dest: 'dist/',
replacements: [{
from: 'bower_components',
to: '..'
}]
}
},
// Mocha
mocha: {
all: {
src: ['tests/index.html'],
},
options: {
run: true
}
},
uglify: {
options: {
beautify: {
ascii_only: true,
},
sourceMap: true,
sourceMapIncludeSources: true,
preserveComments: "some"
},
default: {
files: [
{
expand: true, // Enable dynamic expansion.
cwd: 'src/', // Src matches are relative to this path.
src: ['*.js'], // Actual pattern(s) to match.
dest: 'dist/', // Destination path prefix.
//ext: '.js', // Dest filepaths will have this extension.
extDot: 'first' // Extensions in filenames begin after the first dot
},
]
}
},
htmlmin: { // Task
dist: { // Target
options: { // Target options
collapseWhitespace: true,
minifyJS: true,
minifyCSS: true
},
files: { // Dictionary of files
'dist/juicy-tile-list.html': 'src/juicy-tile-list.html' // 'destination': 'source'
}
}
},
bump: {
options: {
files: ['package.json', 'bower.json', 'src/*', 'dist/*.html'],
commit: true,
commitMessage: '%VERSION%',
commitFiles: ['package.json', 'bower.json', 'src/*', 'dist/*'],
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
// pushTo: 'origin',
globalReplace: false,
prereleaseName: false,
regExp: false
}
}
});
grunt.loadNpmTasks('grunt-text-replace');
// grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['replace']);
grunt.registerTask('test', ['mocha']);
grunt.registerTask('minify', ['uglify','htmlmin']);
grunt.registerTask(
'release',
"Minify and bump the version",
function(versionType, incOrCommitOnly) {
grunt.task.run('minify', "bump" + (versionType ? ":"+versionType : ""));
}
);
};