-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·127 lines (115 loc) · 4.17 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
module.exports = function(grunt) {
var es2015Preset = require('babel-preset-env');
var reactPreset = require('babel-preset-react');
function stripPrefixForTemplates(filePath) {
/**
* Strip '../../public/js/cat_source/templates/'
* from template identifiers.
*/
var dirsToStrip = 3 ;
var strippedPath = filePath.split('/')
.splice( dirsToStrip ).join('/')
.replace('.hbs', '') ;
return strippedPath ;
}
grunt.initConfig( {
handlebars: {
options: {
namespace: 'MateCat.Templates',
processPartialName: stripPrefixForTemplates,
processName: stripPrefixForTemplates
},
all: {
src : [
'static/src/templates/review_improved/segment_buttons.hbs'
],
dest : 'static/build/js/templates.js'
}
},
browserify: {
components: {
options: {
transform: [
[ 'babelify', { presets: [ es2015Preset, reactPreset ] } ]
],
browserifyOptions: {
paths: [ __dirname + '/node_modules' ]
}
},
src: [
'static/src/js/components/review_improved/*.js',
'static/src/js/components/*.js',
],
dest: 'static/build/js/ebay-components.js'
},
qaReportsVersions: {
options: {
transform: [
[ 'babelify', { presets: [ es2015Preset, reactPreset ] } ]
],
browserifyOptions: {
paths: [ __dirname + '/node_modules' ]
}
},
src: [
'static/src/js/quality_report/review_improved.qa_report.js',
],
dest: 'static/build/js/qa-report-improved.js'
},
},
concat: {
app: {
options: {
sourceMap: false,
},
src: [
'static/src/js/libs/handlebars.runtime-v4.0.5.js',
'static/build/js/templates.js',
'static/src/js/review_improved/review_improved.js',
'static/src/js/review_improved/review_improved.common_extensions.js',
'static/src/js/review_improved/review_improved.common_events.js',
'static/src/js/review_improved/review_improved.translate_extensions.js',
'static/src/js/review_improved/review_improved.translate_events.js',
'static/src/js/review_improved/review_improved.review_extension.js',
'static/src/js/review_improved/review_improved.review_events.js',
'static/src/js/review_improved/review_improved.rangy-hack.js',
],
dest: 'static/build/js/ebay-core.js'
},
},
sass: {
app: {
options : {
sourceMap : false,
},
src: [
'static/src/css/sass/review_improved.scss'
],
dest: 'static/build/css/review_improved.css'
},
upload: {
options : {
sourceMap : false,
},
src: [
'static/src/css/sass/ebay-upload.scss'
],
dest: 'static/build/css/ebay-upload.css'
},
}
});
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.loadNpmTasks('grunt-sass');
// Define your tasks here
grunt.registerTask('default', ['bundle:js']);
grunt.registerTask('bundle:js', [
'handlebars',
'browserify:components',
'browserify:qaReportsVersions',
'concat',
'sass'
]);
};