-
Notifications
You must be signed in to change notification settings - Fork 56
/
Gruntfile.js
126 lines (112 loc) · 4.23 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
module.exports = function (grunt) {
'use strict';
var _ = require('underscore'),
pkg = grunt.file.readJSON('package.json'),
rVersion = /@VERSION/g,
rHomepage = /@HOMEPAGE/g;
grunt.initConfig({
pkg: pkg,
clean: ['dist/'],
jshint: {
src: ['GruntFile.js', 'src/**/*.js'],
options: {
globals: {
require: true,
module: true,
jQuery: true
},
bitwise: true,
camelcase: true,
curly: true,
eqeqeq: true,
forin: true,
immed: true,
indent: 4,
latedef: true,
newcap: true,
nonew: true,
quotmark: 'single',
undef: true,
unused: true,
strict: true,
trailing: true,
browser: true
}
},
jasmine: {
src: 'src/js/jquery.rs.carousel.js',
options: {
specs: 'tests/spec/*.js',
helpers: 'tests/lib/jasmine-jquery.js',
vendor: ['vendor/modernizr.3dtransforms.touch.js', 'vendor/jquery.js', 'vendor/jquery.ui.widget.js'],
styles: ['tests/lib/reset.css', 'src/css/*.css']
}
},
copy: {
build: {
options: {
processContent: function (file) {
return file
.replace(rVersion, pkg.version)
.replace(rHomepage, pkg.homepage);
}
},
files: [{
expand: true,
cwd: 'src/',
src: ['**'],
dest: 'dist/'
}]
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %>-min.js | <%= pkg.version %> | <%= grunt.template.today("yyyy-mm-dd") %> | <%= pkg.docs %> */\n',
report: 'gzip'
},
build: {
files: {
'dist/js/min/<%= pkg.name %>-min.js': ['dist/js/<%= pkg.name %>.js'],
'dist/js/min/<%= pkg.name %>-autoscroll-min.js': ['dist/js/<%= pkg.name %>-autoscroll.js'],
'dist/js/min/<%= pkg.name %>-continuous-min.js': ['dist/js/<%= pkg.name %>-continuous.js'],
'dist/js/min/<%= pkg.name %>-touch-min.js': ['dist/js/<%= pkg.name %>-touch.js'],
'dist/js/min/<%= pkg.name %>-all-min.js': ['dist/js/*.js']
}
}
},
cssmin: {
options: {
banner: '/*! <%= pkg.name %>-min.css | <%= pkg.version %> | <%= grunt.template.today("yyyy-mm-dd") %> | <%= pkg.docs %> */',
report: 'gzip'
},
build: {
src: 'dist/css/*.css',
dest: 'dist/css/min/rs-carousel-min.css'
}
},
jquerymanifest: {
options: {
source: '<%= pkg %>',
overrides: {
name: 'rs.carousel',
keywords: _.without(pkg.keywords, 'jquery'),
dependencies: {
jquery: '>=1.8',
'jquery.ui.widget': '>=1.8'
},
// https://github.com/PixelMEDIA/grunt-jquerymanifest/commit/db34b1750dd8fb9ee9fffada1b793225426d730c
licenses: pkg.licenses,
author: pkg.author
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-jquerymanifest');
grunt.registerTask('default', ['clean', 'jshint', 'jasmine', 'copy', 'uglify', 'cssmin', 'jquerymanifest']);
};