forked from pupunzi/jquery.mb.YTPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
172 lines (156 loc) · 4.8 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
dist: {
files: [
{flatten: true, expand: true, cwd: '../jquery.mb.browser/inc/', src: ['jquery.mb.browser.min.js'], dest: 'src/dep/'},
{flatten: true, expand: true, cwd: '../jquery.mb.storage/inc/', src: ['jquery.mb.storage.min.js'], dest: 'src/dep/'},
{flatten: true, expand: true, cwd: '../jquery.mb.CSSAnimate/inc/', src: ['jquery.mb.CSSAnimate.min.js'], dest: 'src/dep/'},
{flatten: true, expand: true, cwd: '../jquery.mb.simpleSlider/inc/', src: ['jquery.mb.simpleSlider.min.js'], dest: 'src/dep/'},
{flatten: false, expand: true, cwd: 'src/css/font/', src: ['**'], dest: 'dist/css/font/'},
{flatten: false, expand: true, cwd: 'src/css/images/', src: ['**'], dest: 'dist/css/images/'},
{flatten: true, expand: true, cwd: 'src/', src: ['index.tmpl'], dest: 'dist/',
rename: function (dest, src) {
return dest + src.replace('.tmpl', '.html');
}
}
]
}
},
concat: {
options: {
separator: ';'
},
dist : {
src : [ 'src/*.js', 'src/dep/*.js'],
dest: 'dist/<%= pkg.title %>.js'
}
},
uglify: {
options: {
banner: '/*' +
'<%= pkg.title %> <%= grunt.template.today("dd-mm-yyyy") %>\n' +
' _ jquery.mb.components \n' +
' _ email: [email protected] \n' +
' _ Copyright (c) 2001-<%= grunt.template.today("yyyy") %>. Matteo Bicocchi (Pupunzi); \n' +
' _ blog: http://pupunzi.open-lab.com \n' +
' _ Open Lab s.r.l., Florence - Italy \n' +
' */\n'
},
dist: {
files: {
'dist/<%= pkg.title %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
cssmin: {
options: {
shorthandCompacting: true,
roundingPrecision : -1
},
dist : {
files: {
'dist/css/<%= pkg.name %>.min.css': ['src/css/*.css']
}
}
},
includereplace: {
dist: {
options: {
prefix : '{{ ',
suffix : ' }}',
globals: {
version: '<%= pkg.version %>',
buildnum: '<%= grunt.file.readJSON("package.json").buildnum %>'
}
},
files : [
{src: 'dist/*.js', expand: true},
{src: 'dist/*.html', expand: true},
{src: 'dist/css/*.css', expand: true}
]
}
},
jsbeautifier: {
files : ['src/*.js', '!dist/*.min.js', 'src/*.html', 'src/*.tmpl', 'src/css/*.css'],
options: {
html: {
braceStyle : "collapse",
indentChar : "\t",
indentScripts : "keep",
indentSize : 1,
maxPreserveNewlines: 3,
preserveNewlines : true,
spaceInParen : true,
unformatted : ["a", "sub", "sup", "b", "i", "u"],
wrapLineLength : 0
},
css : {
indentChar : " ",
maxPreserveNewlines: 1,
preserveNewlines : false,
indentSize : 4
},
js : {
braceStyle : "collapse",
breakChainedMethods : false,
e4x : false,
evalCode : false,
indentChar : "\t",
indentLevel : 0,
indentSize : 1,
indentWithTabs : false,
jslintHappy : false,
keepArrayIndentation : true,
keepFunctionIndentation: true,
maxPreserveNewlines : 3,
preserveNewlines : true,
spaceBeforeConditional : false,
spaceInParen : true,
unescapeStrings : false,
wrapLineLength : 0,
endWithNewline : true
}
}
},
buildnumber: {
options: {
field: 'buildnum'
},
files : ['package.json', 'bower.json']
},
bump: {
options: {
files : ['package.json', 'bower.json'],
updateConfigs : [],
commit : true,
commitMessage : 'Release v%VERSION% stable',
commitFiles : ['-a'],
createTag : true,
tagName : '%VERSION%',
tagMessage : 'Version %VERSION%',
push : true,
pushTo : 'https://github.com/pupunzi/jquery.mb.YTPlayer.git',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace : true,
prereleaseName : 'alpha',
regExp : false
}
},
watch: {
files: ['src/css/*.css', 'src/*.js', 'src/*.html', 'Gruntfile.js'],
tasks: ['default']
}
});
grunt.loadNpmTasks('grunt-include-replace');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks("grunt-jsbeautifier");
grunt.loadNpmTasks('grunt-build-number');
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('default', ['buildnumber', 'jsbeautifier', 'copy', 'concat', 'uglify', 'cssmin', 'includereplace']);
};