-
Notifications
You must be signed in to change notification settings - Fork 25
/
Gruntfile.js
153 lines (140 loc) · 4.7 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
/*global exports:true, require:true */
module.exports = exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
port: 8181,
hostname: '*'
}
}
},
concat: {
options: {
banner: "/*!\n"+
"* Optiscroll.js v<%= pkg.version %>\n"+
"* https://github.com/albertogasparin/Optiscroll/\n"+
"* \n"+
"* @copyright <%= grunt.template.today('yyyy') %> Alberto Gasparin\n"+
"* @license Released under MIT LICENSE\n"+
"*/\n\n",
separator: "\n\n",
},
nojquery: {
src: [
'src/intro.js',
'src/optiscroll.js',
'src/events.js',
'src/scrollbar.js',
'src/utils.js',
'src/globals.js',
'src/outro.js',
],
dest: 'dist/optiscroll.js'
},
jquery: {
options: { banner: "" },
src: [
'dist/optiscroll.js',
'src/jquery.plugin.js'
],
dest: 'dist/jquery.optiscroll.js'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
// source: ['src/*.js', 'src/**/*.js']
source: ['dist/optiscroll.js']
},
uglify: {
dist: {
options: {
preserveComments: 'some',
compress: {
sequences: true,
dead_code: true,
conditionals: true,
booleans: true,
unused: true,
if_return: true,
join_vars: true,
drop_console: true
}
},
files: {
'dist/optiscroll.min.js': ['dist/optiscroll.js'],
'dist/jquery.optiscroll.min.js': ['dist/jquery.optiscroll.js']
}
}
},
sass: {
dist: {
options: {
outputStyle: 'compressed'
},
files: {
'dist/optiscroll.css': ['scss/optiscroll.scss']
}
}
},
autoprefixer: {
options: {
browsers: ['last 3 versions', 'IE 11']
},
dist: {
files: {
'dist/optiscroll.css': ['dist/optiscroll.css']
}
}
},
watch: {
build: {
files: ['src/*.js', 'src/**/*.js'],
tasks: ['build']
},
css: {
files: ['scss/*.scss'],
tasks: ['sass', 'autoprefixer']
},
grunt: {
files: [
'Gruntfile.js'
]
}
},
bump: {
options: {
files: ['package.json','bower.json'],
updateConfigs: ['pkg'],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json','bower.json','dist/optiscroll.min.js','dist/optiscroll.js','dist/jquery.optiscroll.min.js','dist/jquery.optiscroll.js','dist/optiscroll.css'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
// pushTo: 'upstream',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
}
},
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['connect', 'build', 'watch']);
grunt.registerTask('build', ['concat', 'uglify', 'sass', 'autoprefixer']);
grunt.registerTask('test', ['build', 'connect']);
// For version bumps you need to run the following three commands
// - grunt bump-only:minor
// - grunt buold
// - grunt bump-commit
// Or one of these tasks
// Version bumb v1.0.0 => v1.0.1
grunt.registerTask('bump-patch', ['bump-only:patch', 'build', 'bump-commit']);
// Version bumb v1.0.0 => v1.1.0
grunt.registerTask('bump-minor', ['bump-only:minor', 'build', 'bump-commit']);
// Version bumb v1.0.0 => v2.0.0
grunt.registerTask('bump-major', ['bump-only:major', 'build', 'bump-commit']);
};