-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
108 lines (105 loc) · 3.92 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
module.exports = function(grunt) {
var hatemilePath = 'dist/scripts/hatemile/';
var hatemilePathJS = hatemilePath + 'js/hatemile/';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
eslint: {
options: {
configFile: 'eslint.json'
},
files: [
'Gruntfile.js',
'src/scripts/*.js'
]
},
copy: {
main: {
files: [
// includes files within path and its sub-directories
{expand: true, cwd: 'src/', src: ['**'], dest: 'dist/'}
]
}
},
clean: {
remove_dist_files: ['dist/'],
remove_unused_files: [
hatemilePath + 'bower.json',
hatemilePath + 'CODE_OF_CONDUCT.md',
hatemilePath + 'CONTRIBUTING.md',
hatemilePath + 'Gruntfile.js',
hatemilePath + 'package.json',
hatemilePath + 'README.md',
hatemilePath + '.git',
hatemilePath + '.github/',
hatemilePath + 'coffee/',
hatemilePath + '_locales/',
hatemilePathJS + 'AccessibleAssociation.js',
hatemilePathJS + 'AccessibleCSS.js',
hatemilePathJS + 'AccessibleDisplay.js',
hatemilePathJS + 'AccessibleEvent.js',
hatemilePathJS + 'AccessibleForm.js',
hatemilePathJS + 'AccessibleNavigation.js',
hatemilePathJS + 'util/html/HTMLDOMElement.js',
hatemilePathJS + 'util/html/HTMLDOMNode.js',
hatemilePathJS + 'util/html/HTMLDOMParser.js',
hatemilePathJS + 'util/html/HTMLDOMTextNode.js',
hatemilePathJS + 'util/html/jquery/',
hatemilePathJS + 'util/css/',
hatemilePathJS + 'implementation/AccessibleCSSImplementation.js'
]
},
comments: {
hatemile_for_javascript: {
options: {
singleline: true,
multiline: true,
keepSpecialComments: false
},
src: [hatemilePath + '**/*.js']
}
},
'regex-replace': {
main: {
src: [hatemilePathJS +
'util/html/vanilla/VanillaHTMLDOMElement.js'],
actions: [
{
name: 'remove_get_inner_html',
search: 'VanillaHTMLDOMElement\\.prototype\\.' +
'getInnerHTML = function \\(\\) {' +
'[\\n\\r\\t\\s]*return this\\.data\\.' +
'innerHTML;[\\n\\r\\t\\s]*};',
replace: '',
flags: 'g'
},
{
name: 'remove_get_outer_html',
search: 'VanillaHTMLDOMElement\\.prototype\\.' +
'getOuterHTML = function \\(\\) {' +
'[\\n\\r\\t\\s]*return this\\.data\\.' +
'outerHTML;[\\n\\r\\t\\s]*};',
replace: '',
flags: 'g'
}
]
}
}
});
// Load dependencies.
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-stripcomments');
grunt.loadNpmTasks('grunt-regex-replace');
// Default task(s).
grunt.registerTask('test', ['eslint']);
grunt.registerTask('default', [
'eslint',
'clean:remove_dist_files',
'copy',
'clean:remove_unused_files',
'comments',
'regex-replace'
]);
};