forked from ablanco/jquery.pwstrength.bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
100 lines (94 loc) · 2.95 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
/*jslint node: true */
/*global */
module.exports = function (grunt) {
"use strict";
var license =
'/*!\n' +
'* jQuery Password Strength plugin for Zurb Foundation\n' +
'* <%= grunt.template.today("yyyy-mm-dd") %>\n' +
'*\n' +
'* Copyright (c) 2008-2013 Tane Piper\n' +
'* Copyright (c) 2013 Alejandro Blanco\n' +
'* Copyright (c) 2014 Ed Townend\n' +
'* Dual licensed under the MIT and GPL licenses.\n' +
'*/\n\n' +
'(function (jQuery) {\n';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jslint: {
client: {
src: [
'src/*js', 'spec/*js', 'Gruntfile.js'
],
directives: {
browser: true,
predef: [
'jQuery'
]
}
}
},
jasmine_node: {
options: {
forceExit: true,
jUnit: {
report: false
}
},
all: ['spec/']
},
concat: {
options: {
banner: license,
footer: '}(jQuery));',
process: function (src, filepath) {
// Remove ALL block comments, the stripBanners only removes
// the first one
src = src.replace(/\/\*[\s\S]*?\*\//g, '');
return '// Source: ' + filepath + src;
}
},
dist: {
src: [
'src/rules.js', 'src/options.js', 'src/ui.js',
'src/methods.js'
],
dest: '<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '/* <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> - GPLv3 & MIT License */\n',
sourceMap: true,
sourceMapName: '<%= pkg.name %>.min.map'
},
dist: {
files: {
'<%= pkg.name %>.min.js': [
'<%= concat.dist.dest %>'
]
}
}
},
shell: {
copyFile: {
command: 'cp <%= concat.dist.dest %> examples/pwstrength.js'
},
makeDir: {
command: 'mkdir -p dist'
},
moveFiles: {
command: 'mv <%= pkg.name %>* dist/'
}
}
});
// Load the plugins
grunt.loadNpmTasks('grunt-jslint');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.registerTask('test', ['jslint', 'jasmine_node']);
// Default task(s)
grunt.registerTask('default', ['jslint', 'concat', 'uglify', 'shell']);
};