This repository has been archived by the owner on May 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
85 lines (83 loc) · 2.69 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
dist: {
options: {
separator: ';\n',
banner: '/*!\n'
+ ' * Selectors.js - https://github.com/selectors/selectors.js\n\n'
+ ' * Released under the MIT license\n'
+ ' * https://github.com/selectors/selectors.js/blob/master/LICENSE.md\n\n'
+ ' * Last built: <%= grunt.template.today("dddd, dS mmmm yyyy; h:MM:ss TT") %>\n'
+ ' */\n\n'
+ '"use strict";',
process: function(src, filepath) {
return '\n/* Source: ' + filepath
+ '\n * -------------------------------------------------------------------------------------'
+ src.replace(/^\/\* https:\/\/github.com\/selectors\/selectors\.js/, '');
}
},
src: [
'src/selectors.js',
'src/helper.js',
'src/W3Core.js',
'src/W3Extended.js',
'src/W3Grammar.js',
'src/namespaces.js',
'src/attributes.js',
'src/pseudo.js'
],
dest: 'dist/selectors.js'
},
htmlStrict: {
options: {
process: function(src, filepath) {
return '\n/* Source: ' + filepath
+ '\n * -------------------------------------------------------------------------------------'
+ src.replace(/^\/\* https:\/\/github.com\/selectors\/selectors\.js/, '');
}
},
src: [
'dist/selectors.js',
'src/addon/htmlStrict.js'
],
dest: 'dist/selectors-html.js'
}
},
uglify: {
options: {
banner: '/*! Selectors.js v<%= pkg.version %> | '
+ '(c) https://github.com/selectors/selectors.js | https://github.com/selectors/selectors.js/blob/master/LICENSE.md */\n',
},
dist: {
files: {
'dist/selectors.min.js': ['dist/selectors.js'],
'dist/selectors-html.min.js': ['dist/selectors-html.js']
}
}
},
jasmine: {
dist: {
src: "dist/selectors.min.js",
options: {
specs: "test/*.js"
}
},
htmlStrict: {
src: "dist/selectors-html.min.js",
options: {
specs: [
"test/addon/s._isValidHtmlAttribute.js",
"test/addon/s._isValidHtmlElement.js"
]
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.registerTask('test', ['jasmine']);
grunt.registerTask('default', ['concat', 'uglify', 'test']);
};