forked from RajKumarBhardwaj/yerslider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
172 lines (142 loc) · 3.15 KB
/
Gruntfile.js
File metadata and controls
172 lines (142 loc) · 3.15 KB
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
// SETUP {
/*
VERSIONING
versioning via bump: https://github.com/vojtajina/grunt-bump
step 1
commit changes
step 2
grunt uglify
grunt sass
step 3
grunt bump:patch 1.0.0 -> 1.0.1
grunt bump:minor 1.0.1 -> 1.1.0
grunt bump:major 1.1.0 -> 2.0.0
grunt bump --setversion=1.7.8
step 4
After bumping run following grunt tasks
to update the version to all files:
grunt uglify
grunt sass
step 5
ame the bump changes to the last commit
*/
var setup = {};
setup.banner = '/*\r\n' +
' * @package <%= pkg.name %>\r\n' +
' * @version <%= pkg.version %>\r\n' +
' * @date <%= grunt.template.today("yyyy-mm-dd") %>\r\n' +
' * @time <%= grunt.template.today("H:MM:ss") %>\r\n' +
' * @license <%= pkg.license %>\r\n' +
' * @repository <%= pkg.repository.url %>\r\n' +
' * @homepage <%= pkg.homepage %>\r\n' +
' */\r\n';
setup.uglify_options = {
compress: true,
mangle: true,
report: 'gzip',
banner: setup.banner,
};
// }
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bump: {
options: {
files: ['package.json'],
updateConfigs: [],
commit: false,
push: false,
}
},
uglify: {
core_yerslider: {
files: {
'core/yerslider.min.js': 'core/yerslider.js',
},
options: setup.uglify_options
},
theme_default: {
files: {
'themes/default/yerslider.min.js': 'themes/default/yerslider.js',
},
options: setup.uglify_options
}
},
sass: {
expanded: {
options: {
style: 'expanded',
//banner: setup.banner,
},
files: [{
expand: true,
cwd: 'themes/',
src: ['**/*.scss'],
dest: 'themes/',
ext: '.css',
extDot: 'first'
}]
},
min: {
options: {
style: 'compressed',
//banner: setup.banner,
},
files: [{
expand: true,
cwd: 'themes/',
src: ['**/*.scss'],
dest: 'themes/',
ext: '.min.css',
extDot: 'first'
}]
}
},
concat: {
options: {
separator: "\n\n",
banner: '',
footer: '',
},
demojs: {
src: [
'dependencies/imagesloaded.js',
'dependencies/jquery.touchSwipe.js',
'themes/default/yerslider.min.js',
'core/yerslider.min.js',
],
dest: 'demo/js/demo.yerslider.js',
},
},
watch: {
//livereload: {
// files: ['core/*','demo/**/*','themes/**/*'],
// options: {
// livereload: true,
// },
//},
demojs: {
files: ['core/*','dependencies/**/*','themes/**/*'],
tasks: ['concat:demojs'],
},
watch_core_yerslider: {
files: ['core/yerslider.js'],
tasks: ['uglify:core_yerslider'],
},
watch_theme_default_js: {
files: ['themes/default/yerslider.js'],
tasks: ['uglify:theme_default'],
},
watch_theme_default_styles: {
files: ['themes/default/yerslider-styles.scss'],
tasks: ['sass'],
},
},
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('default', ['watch']);
};