diff options
author | Johann-S <johann.servoire@gmail.com> | 2018-03-04 00:04:11 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2018-10-20 15:32:09 +0300 |
commit | caefd7046372e954d21550bbdadcabf98b2a86f0 (patch) | |
tree | 9e1835a7d61a8302c4dcaaff5b5a023efcae96b1 /build | |
parent | bf573896472c83e2b85b52f6cbf606765b73cb3e (diff) |
Add touch support in our carousel with HammerJS.
Diffstat (limited to 'build')
-rw-r--r-- | build/build-plugins.js | 11 | ||||
-rw-r--r-- | build/generate-sri.js | 4 | ||||
-rw-r--r-- | build/rollup.config.js | 26 |
3 files changed, 27 insertions, 14 deletions
diff --git a/build/build-plugins.js b/build/build-plugins.js index 1de65b426d..299f502d9d 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -5,10 +5,10 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ -const path = require('path') -const rollup = require('rollup') -const babel = require('rollup-plugin-babel') -const banner = require('./banner.js') +const path = require('path') +const rollup = require('rollup') +const babel = require('rollup-plugin-babel') +const banner = require('./banner.js') const TEST = process.env.NODE_ENV === 'test' const plugins = [ @@ -41,8 +41,9 @@ const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/' function build(plugin) { console.log(`Building ${plugin} plugin...`) - const external = ['jquery', 'popper.js'] + const external = ['hammerjs', 'jquery', 'popper.js'] const globals = { + hammerjs: 'Hammer', jquery: 'jQuery', // Ensure we use jQuery which is always available even in noConflict mode 'popper.js': 'Popper' } diff --git a/build/generate-sri.js b/build/generate-sri.js index 6929097703..13b90db1ce 100644 --- a/build/generate-sri.js +++ b/build/generate-sri.js @@ -42,6 +42,10 @@ const files = [ { file: 'node_modules/popper.js/dist/umd/popper.min.js', configPropertyName: 'popper_hash' + }, + { + file: 'node_modules/hammerjs/hammer.min.js', + configPropertyName: 'hammer_hash' } ] diff --git a/build/rollup.config.js b/build/rollup.config.js index c8acf7a9e9..72e3951fa6 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -1,12 +1,13 @@ -const path = require('path') -const babel = require('rollup-plugin-babel') -const resolve = require('rollup-plugin-node-resolve') -const banner = require('./banner.js') +const path = require('path') +const babel = require('rollup-plugin-babel') +const resolve = require('rollup-plugin-node-resolve') +const commonjs = require('rollup-plugin-commonjs') +const banner = require('./banner.js') const BUNDLE = process.env.BUNDLE === 'true' -let fileDest = 'bootstrap.js' -const external = ['jquery', 'popper.js'] +let fileDest = 'bootstrap.js' +const external = ['jquery', 'hammerjs', 'popper.js'] const plugins = [ babel({ exclude: 'node_modules/**', // Only transpile our source code @@ -21,15 +22,22 @@ const plugins = [ ] const globals = { jquery: 'jQuery', // Ensure we use jQuery which is always available even in noConflict mode + hammerjs: 'Hammer', 'popper.js': 'Popper' } if (BUNDLE) { fileDest = 'bootstrap.bundle.js' - // Remove last entry in external array to bundle Popper - external.pop() + // We just keep jQuery as external + external.length = 1 delete globals['popper.js'] - plugins.push(resolve()) + delete globals.hammerjs + plugins.push( + commonjs({ + include: 'node_modules/**' + }), + resolve() + ) } module.exports = { |