Last active
September 29, 2016 03:23
-
-
Save kshep92/7dd945d32889cd01f3d1c0b4d02678dc to your computer and use it in GitHub Desktop.
Sample Aurelia bundler configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require("gulp"); | |
var bundler = require('aurelia-bundler'); | |
var del = require("del"); | |
var aureliaBundle = { | |
"includes": [ | |
"aurelia-auth", | |
"aurelia-bootstrapper", | |
"aurelia-event-aggregator", | |
"aurelia-fetch-client", | |
"aurelia-framework", | |
"aurelia-materialize-bridge", | |
"aurelia-materialize-bridge/**/*.html!text", | |
"aurelia-materialize-bridge/**/*.js", | |
"aurelia-materialize-bridge/**/*.css!text", | |
"aurelia-templating", | |
"aurelia-templating-binding", | |
"aurelia-templating-resources", | |
"aurelia-templating-router", | |
"aurelia-validation", | |
"aurelia-loader-default", | |
"aurelia-router", | |
"aurelia-history-browser", | |
"aurelia-logging-console", | |
"bluebird", | |
"fetch", | |
"moment", | |
"materialize", | |
"nprogress", | |
"numeral" | |
//"text", | |
//"css" | |
], | |
"options": { | |
"inject": true, | |
"minify": true, | |
"rev": true | |
} | |
}; | |
var appBundle = { | |
"includes": [ | |
"[**/*.js]", | |
"**/*.html!text", | |
"**/*.css!css" | |
], | |
"options": { | |
"inject": true, | |
"minify": false, // minification will not work with es6 modules because of uglify-js incompatibility | |
"rev": true | |
} | |
}; | |
var prodBundle = { | |
"dist/aurelia": aureliaBundle, | |
"dist/app": appBundle | |
}; | |
var devBundle = { | |
"dist/aurelia": aureliaBundle | |
}; | |
var prodConfig = { | |
force: true, // Force overwrite bundle file if already exists. Default false | |
baseURL: './wwwroot', // `baseURL of the application` | |
configPath: './wwwroot/config.js', // `config.js` path. Must be within `baseURL` | |
bundles: prodBundle | |
}; | |
var devConfig = { | |
force: true, // Force overwrite bundle file if already exists. Default false | |
baseURL: './wwwroot', // `baseURL of the application` | |
configPath: './wwwroot/config.js', // `config.js` path. Must be within `baseURL` | |
bundles: devBundle | |
}; | |
gulp.task('del', function () { | |
return del("wwwroot/dist/*.js"); | |
}); | |
gulp.task('unbundle', ["del"], function () { | |
return bundler.unbundle(prodConfig); | |
}); | |
gulp.task('prodBundle', ['unbundle'], function () { // Running `unbundle` before bundling is a good practice. | |
return bundler.bundle(prodConfig); | |
}); | |
gulp.task('devBundle', ['unbundle'], function () { // Running `unbundle` before bundling is a good practice. | |
return bundler.bundle(devConfig); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment