Generate dist file using es6-module-packager

This commit is contained in:
kpdecker
2013-10-09 02:20:52 -07:00
parent a8cd3201b5
commit 63bb459ac6
3 changed files with 30 additions and 3 deletions
+16 -1
View File
@@ -25,6 +25,21 @@ module.exports = function(grunt) {
connect: config('connect'),
transpile: config('transpile'),
packager: {
options: {
export: 'Handlebars'
},
global: {
files: [{
cwd: 'lib/',
expand: true,
src: ['handlebars*.js'],
dest: 'dist/'
}]
}
},
uglify: {
options: {
mangle: true,
@@ -49,7 +64,7 @@ module.exports = function(grunt) {
'parser',
'transpile:amd',
'transpile:cjs',
'concat',
'packager',
'uglify']);
// Run a server. This is ideal for running the QUnit tests in the browser.
+2 -2
View File
@@ -25,8 +25,8 @@
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-watch": "~0.4.4",
"grunt-hang": "~0.1.2",
"grunt-es6-module-transpiler": "~0.4.1",
"es6-module-transpiler": "*",
"grunt-es6-module-transpiler": "joefiorini/grunt-es6-module-transpiler",
"es6-module-packager": "*",
"jison": "~0.3.0",
"keen.io": "0.0.3",
"mocha": "*",
+12
View File
@@ -0,0 +1,12 @@
var Packager = require('es6-module-packager').default,
fs = require('fs');
module.exports = function(grunt) {
grunt.registerMultiTask('packager', 'Transpiles scripts written using ES6 to ES5.', function() {
var options = this.options();
this.files.forEach(function(file) {
var packager = new Packager(file.src[0], {export: options.export});
fs.writeFileSync(file.dest, packager.toLocals());
});
});
};