-
Notifications
You must be signed in to change notification settings - Fork 42
/
Gruntfile.js
122 lines (117 loc) · 2.44 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
/*jslint node: true */
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
js_concat: {
src: [
'_tmpl/js/*.js',
'_tmpl/js/**/*.js'
],
dest: 'dist/js/pattern-lib.js'
},
css_concat: {
src: [
'_tmpl/css/*.css',
'_tmpl/css/**/*.css'
],
dest: 'dist/css/pattern-lib.css'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'dist/js/pattern-lib.min.js': ['<%= concat.js_concat.dest %>']
}
}
},
cssmin: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
combine: {
files: {
'<%= concat.css_concat.dest %>': '<%= concat.css_concat.src %>'
}
}
},
jshint: {
files: ['Gruntfile.js'],
options: {
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
watch: {
files: [
'_tmpl/*',
'_tmpl/**/*.css',
'_tmpl/**/*.js'
],
tasks: 'default'
},
copy: {
main: {
files: [
{
src: ['_tmpl/*.php', '_tmpl/*.ico'],
dest: 'dist/',
expand: true,
flatten: true,
filter: 'isFile'
},
{
src: ['_tmpl/patterns/*'],
dest: 'dist/patterns',
expand: true,
flatten: true,
filter: 'isFile'
},
{
src: ['_tmpl/img/*'],
dest: 'dist/img',
expand: true,
flatten: true,
filter: 'isFile'
}
]
}
},
clean: ['dist'],
chmod: {
options: {
},
readonly: {
options: {
mode: '555'
},
src: ['dist/**']
},
writeable: {
options: {
mode: '755'
},
src: ['dist/**']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-chmod');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('cleanup', ['chmod:writeable', 'clean', 'chmod:readonly']);
grunt.registerTask('default', ['chmod:writeable', 'clean', 'concat', 'jshint', 'uglify', 'cssmin', 'copy', 'chmod:readonly']);
grunt.registerTask('watch', ['chmod:writeable', 'clean', 'concat', 'jshint', 'uglify', 'cssmin', 'copy', 'chmod:readonly']);
};