forked from Xelio/requestly
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
113 lines (103 loc) · 2.64 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
/**
* @References
* [0] http://gruntjs.com/getting-started to install grunt-cli
* [1]: https://github.com/01org/grunt-zipup
* [2]: https://github.com/gruntjs/grunt-contrib-handlebars
* [3]: http://gruntjs.com/configuring-tasks#files
**/
module.exports = function (grunt) {
grunt.initConfig({
zipup: {
package: {
appName: 'Requestly',
version: '4.0.1',
files: [
{
cwd: 'src',
src: [
'pages/libs.js',
'pages/main.js',
'pages/main.css',
'background/*',
'Shared/*'
],
expand: true,
dest: 'src'
},
{ cwd: 'resources', src: '**', expand: true, dest: 'resources' },
{ src: 'manifest.json'}
],
outDir: 'build'
}
},
concat: {
options: {
separator: '\n'
},
dist: {
files: {
'src/pages/libs.js': require('./src/pages/jsList.json')['libs'],
'src/pages/main.js': require('./src/pages/jsList.json')['src']
}
}
},
/**
* Task handlebars: Pre-Compile template files, concat them and save output to templates.hbs.js
*/
handlebars: {
compile: {
options: {
namespace: 'RQ.Templates',
processName: function(filePath) {
var pieces = filePath.split('/'),
fileName = pieces[ pieces.length - 1 ];
return fileName.replace(/(\.hbs)/ig, '');
}
},
files: {
'src/pages/templates.hbs.js': 'src/pages/templates/**/*.hbs'
}
}
},
sass: {
dist: {
files: {
'src/pages/main.css': 'src/pages/css/sass/main.scss'
}
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
watch: {
templates: {
files: ['**/*.hbs'],
tasks: ['handlebars']
},
scripts: {
files: ['**/*.js'],
tasks: ['concat']
},
styles: {
files: ['**/*.scss'],
tasks: ['sass']
},
tests: {
files: ['**/*.spec.js'],
tasks: ['karma:unit']
}
}
});
grunt.loadNpmTasks('grunt-zipup');
grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('templates', ['handlebars']);
grunt.registerTask('build', ['handlebars', 'sass', 'concat', 'zipup']);
grunt.registerTask('test', ['karma:unit']);
grunt.registerTask('dev', ['watch']);
};