-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
63 lines (53 loc) · 1.53 KB
/
Gruntfile.js
File metadata and controls
63 lines (53 loc) · 1.53 KB
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
module.exports = function(grunt) {
'use strict';
grunt.loadNpmTasks('grunt-browserify');
// Project configuration.
grunt.initConfig({
browserify: {
ES5: {
files: {
'dist/basic-web-components.js': 'components/**/*.js'
},
options: {
transform: [['babelify', {presets: ['es2015']}]],
ignore: false,
browserifyOptions: {
debug: true
}
}
},
ES6: {
files: {
'dist/basic-web-components.es6.js': 'components/**/*.js',
'dist/demos.js': 'demos/*.js'
},
options: {
transform: [['babelify', {plugins: ['transform-es2015-modules-commonjs']}]],
ignore: false,
browserifyOptions: {
debug: true
}
}
}
}
});
grunt.registerTask('default', function() {
grunt.log.writeln('grunt commands this project supports:');
grunt.log.writeln('');
grunt.log.writeln(' grunt build');
grunt.log.writeln(' grunt watch');
grunt.log.writeln(' grunt watch-es6');
});
grunt.registerTask('build', ['browserify:ES5', 'browserify:ES6']);
grunt.registerTask('watch', function() {
watchHelper(grunt, 'ES5');
});
grunt.registerTask('watch-es6', function() {
watchHelper(grunt, 'ES6');
});
};
function watchHelper(grunt, version) {
grunt.config.set('browserify.' + version + '.options.watch', true);
grunt.config.set('browserify.' + version + '.options.keepAlive', true);
grunt.task.run('browserify:' + version);
}