-
Notifications
You must be signed in to change notification settings - Fork 35
/
Gruntfile.js
121 lines (108 loc) · 3.12 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bannerInfo : '* @version <%= pkg.version %>\n' +
'* @link <%= pkg.url %>\n' +
'* @author <%= pkg.author %>\n' +
'* @author <%= pkg.contributor %>\n' +
'* @license <%= pkg.license %>\n' +
'* @copyright (c) 2011-2013, Stéphane Guigné',
bannerCss : '/* ----------------------------------------------------------------------------\n\n' +
'<%= pkg.fullname %>\n\n' +
'<%= bannerInfo %>\n\n' +
'---------------------------------------------------------------------------- */\n',
banner: '/*! <%= pkg.fullname %>\n' +
'*\n' +
'<%= pkg.description %>\n' +
'*\n' +
'<%= bannerInfo %>\n' +
'*\n' +
'* Last modification : <%= grunt.template.today("yyyy-mm-dd") %>\n' +
'*\n' +
'*/\n',
bannerLight: '/*! <%= pkg.fullname %> (minified)\n' +
'<%= bannerInfo %>\n' +
'*/\n',
watch: {
scripts: {
files: ['src/less/*.less'],
tasks: ['less:watch'],
options: {
nospawn: true,
}
}
},
less: {
watch: {
files: {
"src/css/<%= pkg.name %>.css": "src/less/<%= pkg.name %>.less"
}
},
development: {
files: {
"build/css/<%= pkg.name %>-<%= pkg.version %>.css": "src/less/<%= pkg.name %>.less",
}
},
production: {
options: {
yuicompress: true
},
files: {
"build/css/<%= pkg.name %>-<%= pkg.version %>.min.css": "src/less/<%= pkg.name %>.less",
}
}
},
uglify: {
options: {
banner: '<%= bannerLight %>'
},
build: {
src: 'src/js/<%= pkg.name %>.js',
dest: 'build/js/<%= pkg.name %>-<%= pkg.version %>.min.js'
}
},
clean: ["build/js/*", "build/css/*"],
copy: {
main: {
files: [
{
src: ['src/js/<%= pkg.name %>.js'],
dest: 'build/js/<%= pkg.name %>-<%= pkg.version %>.js',
filter: 'isFile'
}
]
}
},
usebanner: {
addtoJs: {
options: {
position: 'top',
banner: '<%= banner %>'
},
files: {
src: [ 'build/js/<%= pkg.name %>-<%= pkg.version %>.js']
}
},
addtoCss: {
options: {
position: 'top',
banner: '<%= bannerCss %>'
},
files: {
src: [
'build/css/<%= pkg.name %>-<%= pkg.version %>.css',
'build/css/<%= pkg.name %>-<%= pkg.version %>.min.css'
]
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-banner');
grunt.registerTask('release', ['clean','less','uglify','copy','usebanner']);
};