aboutsummaryrefslogtreecommitdiff
path: root/Gruntfile.js
diff options
context:
space:
mode:
authorfat <[email protected]>2015-05-13 10:13:34 -0700
committerfat <[email protected]>2015-05-13 10:13:34 -0700
commitdafdd180cd54a2e238fe715d8aeb83c07f385a18 (patch)
tree7db2949420f90040726e9f26dd5afc2c41364300 /Gruntfile.js
parent6b251582d6c01dfe4e27062118a1af1811625ac5 (diff)
downloadbootstrap-dafdd180cd54a2e238fe715d8aeb83c07f385a18.tar.xz
bootstrap-dafdd180cd54a2e238fe715d8aeb83c07f385a18.zip
add umd module support in dist
Diffstat (limited to 'Gruntfile.js')
-rw-r--r--Gruntfile.js26
1 files changed, 24 insertions, 2 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index e97545e18..f4a907b0c 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -96,6 +96,24 @@ module.exports = function (grunt) {
files: {
'<%= concat.bootstrap.dest %>' : '<%= concat.bootstrap.dest %>'
}
+ },
+ umd: {
+ options: {
+ modules: 'umd'
+ },
+ files: {
+ 'dist/js/umd/util.js' : 'js/src/util.js',
+ 'dist/js/umd/alert.js' : 'js/src/alert.js',
+ 'dist/js/umd/button.js' : 'js/src/button.js',
+ 'dist/js/umd/carousel.js' : 'js/src/carousel.js',
+ 'dist/js/umd/collapse.js' : 'js/src/collapse.js',
+ 'dist/js/umd/dropdown.js' : 'js/src/dropdown.js',
+ 'dist/js/umd/modal.js' : 'js/src/modal.js',
+ 'dist/js/umd/scrollspy.js' : 'js/src/scrollspy.js',
+ 'dist/js/umd/tab.js' : 'js/src/tab.js',
+ 'dist/js/umd/tooltip.js' : 'js/src/tooltip.js',
+ 'dist/js/umd/popover.js' : 'js/src/popover.js'
+ }
}
},
@@ -457,8 +475,12 @@ module.exports = function (grunt) {
// This can be overzealous, so its changes should always be manually reviewed!
grunt.registerTask('change-version-number', 'sed');
- grunt.registerTask('commonjs', 'Generate CommonJS entrypoint module in dist dir.', function () {
- var srcFiles = grunt.config.get('concat.bootstrap.src');
+ grunt.registerTask('commonjs', ['babel:umd', 'npm-js']);
+
+ grunt.registerTask('npm-js', 'Generate npm-js entrypoint module in dist dir.', function () {
+ var srcFiles = Object.keys(grunt.config.get('babel.umd.files')).map(function (filename) {
+ return './' + path.join('umd', path.basename(filename))
+ })
var destFilepath = 'dist/js/npm.js';
generateCommonJSModule(grunt, srcFiles, destFilepath);
});