forked from lorenzofox3/Smart-Table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GruntFile.js
73 lines (72 loc) · 2.24 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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
src: {
js: ['smart-table-module/js/*.js'],
html: ['smart-table-module/partials/*.html']
},
concat: {
options: {
},
dist: {
src: ['<%= src.js %>'],
dest: './<%= pkg.name %>.debug.js'
}
},
"regex-replace": {
dist: {
src: ['<%= pkg.name %>.debug.js'],
actions: [
{
search: '\{\{',
replace: "<%= grunt.option('startSymbol') %>",
flags: "g"
},
{
search: '\}\}',
replace: "<%= grunt.option('endSymbol') %>",
flags: "g"
}
]
}
},
html2js: {
options: {
base: 'smart-table-module',
module: 'smartTable.templates'
},
smartTable: {
src: [ '<%= src.html %>' ],
dest: 'smart-table-module/js/Template.js'
}
},
clean: {
test: ['test_out']
},
copy: {
refApp: {
src: ['<%= pkg.name %>.debug.js'],
dest: 'example-app/js/'
}
},
uglify: {
main: {
src: ['<%= pkg.name %>.debug.js'],
dest: '<%= pkg.name %>.min.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-regex-replace');
grunt.registerTask('refApp', ['html2js:smartTable', 'concat', 'copy:refApp']);
grunt.registerTask('build', function() {
grunt.task.run('html2js:smartTable');
grunt.task.run('concat');
if (grunt.option('startSymbol') && grunt.option('endSymbol')) grunt.task.run('regex-replace');
grunt.task.run('uglify');
});
};