aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorGijs Boddeus <[email protected]>2017-09-13 16:46:14 +0200
committerGitHub <[email protected]>2017-09-13 16:46:14 +0200
commitcf004433e0312482a8c4918d559f38c19a3e14d9 (patch)
tree56fd67d5a60a1fe5442c969d29918db4f463b827 /build
parent4356d08abb4d94785af15f3cc9be0e553f1c1c03 (diff)
parent75d435f76e48b19007495a02e79b0d41f2690361 (diff)
downloadbootstrap-cf004433e0312482a8c4918d559f38c19a3e14d9.tar.xz
bootstrap-cf004433e0312482a8c4918d559f38c19a3e14d9.zip
Merge pull request #4 from twbs/v4-dev
update forked v4-dev
Diffstat (limited to 'build')
-rw-r--r--build/postcss.config.js2
-rw-r--r--build/rollup.config.js51
-rw-r--r--build/stamp.js41
-rw-r--r--build/uglifyjs.config.json7
4 files changed, 57 insertions, 44 deletions
diff --git a/build/postcss.config.js b/build/postcss.config.js
index aef4679fa..cadd98d03 100644
--- a/build/postcss.config.js
+++ b/build/postcss.config.js
@@ -9,7 +9,7 @@ module.exports = (ctx) => ({
browsers: [
//
// Official browser support policy:
- // https://v4-alpha.getbootstrap.com/getting-started/browsers-devices/#supported-browsers
+ // https://getbootstrap.com/docs/4.0/getting-started/browsers-devices/#supported-browsers
//
'Chrome >= 45', // Exact version number here is kinda arbitrary
'Firefox ESR',
diff --git a/build/rollup.config.js b/build/rollup.config.js
new file mode 100644
index 000000000..d6eb0cf5d
--- /dev/null
+++ b/build/rollup.config.js
@@ -0,0 +1,51 @@
+const path = require('path')
+const babel = require('rollup-plugin-babel')
+const resolve = require('rollup-plugin-node-resolve')
+const pkg = require(path.resolve(__dirname, '../package.json'))
+const BUNDLE = process.env.BUNDLE === 'true'
+const year = new Date().getFullYear()
+
+var fileDest = 'bootstrap.js'
+var external = ['jquery', 'popper.js']
+const plugins = [
+ babel({
+ exclude: 'node_modules/**', // only transpile our source code
+ externalHelpersWhitelist: [ // include only required helpers
+ 'typeof',
+ 'classCallCheck',
+ 'createClass',
+ 'inherits',
+ 'possibleConstructorReturn'
+ ]
+ })
+]
+const globals = {
+ jquery: '$',
+ 'popper.js': 'Popper'
+}
+
+if (BUNDLE) {
+ fileDest = 'bootstrap.bundle.js'
+ // remove last entry in external array to bundle Popper
+ external.pop()
+ delete globals['popper.js']
+ plugins.push(resolve())
+}
+
+module.exports = {
+ input: path.resolve(__dirname, '../js/src/index.js'),
+ output: {
+ file: path.resolve(__dirname, `../dist/js/${fileDest}`),
+ format: 'iife'
+ },
+ name: 'bootstrap',
+ external: external,
+ globals: globals,
+ plugins: plugins,
+ banner: `/*!
+ * Bootstrap v${pkg.version} (${pkg.homepage})
+ * Copyright 2011-${year} ${pkg.author}
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+ `
+}
diff --git a/build/stamp.js b/build/stamp.js
deleted file mode 100644
index 8cde189d7..000000000
--- a/build/stamp.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const fs = require('fs')
-
-fs.readFile('package.json', (err, data) => {
- if (err) {
- throw err
- }
-
- const pkg = JSON.parse(data)
- const year = new Date().getFullYear()
-
- const stampTop =
-`/*!
- * Bootstrap v${pkg.version} (${pkg.homepage})
- * Copyright 2011-${year} ${pkg.author}
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- */
-
-if (typeof jQuery === 'undefined') {
- throw new Error('Bootstrap\\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\\'s JavaScript.')
-}
-
-(function ($) {
- var version = $.fn.jquery.split(' ')[0].split('.')
- if ((version[0] < 3) || (version[0] >= 4)) {
- throw new Error('Bootstrap\\'s JavaScript requires at least jQuery v3.0.0 but less than v4.0.0')
- }
-})(jQuery);
-
-(function () {
-`
- const stampEnd = `
-})();`
-
- process.stdout.write(stampTop)
-
- process.stdin.on('end', () => {
- process.stdout.write(stampEnd)
- })
-
- process.stdin.pipe(process.stdout)
-})
diff --git a/build/uglifyjs.config.json b/build/uglifyjs.config.json
index 2b53a56d9..5085f4186 100644
--- a/build/uglifyjs.config.json
+++ b/build/uglifyjs.config.json
@@ -1,5 +1,8 @@
{
- "output" : {
+ "output": {
"comments": "/^!/"
- }
+ },
+ "compress": {
+ "typeofs": false
+ }
}