docs.iife is being generated, albeit without the vendor js - need to combine that separately due to the non-cjs/umd modules

This commit is contained in:
Kevin Ross 2016-03-01 16:07:46 -06:00
parent 546fd9d5b2
commit ef01aa07c3
10 changed files with 78 additions and 16 deletions

View File

@ -1,8 +1,9 @@
branches: branches:
except: except:
- v4-dist - v4-dist
# remove this later # remove the following later:
- v4-dev - v4-dev
- v4-gulp
sudo: false # use the container infrastructure sudo: false # use the container infrastructure
language: node_js language: node_js

View File

@ -61,6 +61,8 @@ cdn:
bootstrap: https://cdn.rawgit.com/twbs/bootstrap/VERSION/dist/js/bootstrap bootstrap: https://cdn.rawgit.com/twbs/bootstrap/VERSION/dist/js/bootstrap
tether: https://cdn.rawgit.com/HubSpot/tether/vVERSION/dist/js/tether tether: https://cdn.rawgit.com/HubSpot/tether/vVERSION/dist/js/tether
'ie10-viewport-bug-workaround': https://maxcdn.bootstrapcdn.com/js/ie10-viewport-bug-workaround.js
#twitter: #twitter:

View File

@ -12,8 +12,7 @@
{% endif %} {% endif %}
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{{ site.baseurl }}/assets/js/ie10-viewport-bug-workaround.js"></script> <script src="{{ site.data.cdn['ie10-viewport-bug-workaround'] }}"></script>
<script src="{{ site.baseurl }}/assets/js/ie-emulation-modes-warning.js"></script>
<script> <script>
$(function() { $(function() {

View File

@ -21,17 +21,17 @@
{% if site.data.minified %} {% if site.data.minified %}
<script src="{{ site.data.cdn.jquery }}.min.js"></script> <script src="{{ site.data.cdn.jquery }}.min.js"></script>
<script src="{{ site.data.cdn.tether }}.min.js"></script> <script src="{{ site.data.cdn.tether }}.min.js"></script>
<script src="{{ site.data.cdn.bootstrap }}.min.js"></script>
<script src="{{ site.baseurl }}/dist/js/docs.iife.min.js"></script> <script src="{{ site.baseurl }}/dist/js/docs.iife.min.js"></script>
{% else %} {% else %}
<script src="{{ site.data.cdn.jquery }}.js"></script> <script src="{{ site.data.cdn.jquery }}.js"></script>
<script src="{{ site.data.cdn.tether }}.js"></script> <script src="{{ site.data.cdn.tether }}.js"></script>
<script src="{{ site.data.cdn.bootstrap }}.js"></script>
<script src="{{ site.baseurl }}/dist/js/docs.iife.js"></script> <script src="{{ site.baseurl }}/dist/js/docs.iife.js"></script>
{% endif %} {% endif %}
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{{ site.baseurl }}/assets/js/ie10-viewport-bug-workaround.js"></script> <script src="{{ site.data.cdn['ie10-viewport-bug-workaround'] }}"></script>
<!-- Docs-only warning about emulation mode - do not use in your page -->
<script src="{{ site.baseurl }}/assets/js/ie-emulation-modes-warning.js"></script> <script src="{{ site.baseurl }}/assets/js/ie-emulation-modes-warning.js"></script>
{% if page.layout == "docs" %} {% if page.layout == "docs" %}

View File

@ -1,6 +1,6 @@
import Style from './style' import Style from './style'
import Clipboard from 'clipboard' import Clipboard from 'clipboard'
import anchors from 'anchor' import anchors from 'anchor-js'
// import all the mdb code // import all the mdb code
import '../../../../js/src/index' // eslint-disable-line no-unused-vars import '../../../../js/src/index' // eslint-disable-line no-unused-vars

View File

@ -37,8 +37,9 @@ Add jQuery, Bootstrap, and our Javascript plugins near the end of your pages, ri
{% highlight html %} {% highlight html %}
<script src="{{ site.data.cdn.jquery }}.min.js"></script> <script src="{{ site.data.cdn.jquery }}.min.js"></script>
<script src="{{ site.data.cdn.tether }}.min.js"></script> <script src="{{ site.data.cdn.tether }}.min.js"></script>
<script src="{{ site.data.cdn.bootstrap }}.min.js"></script>
<script src="{{ site.cdn.js }}.iife.min.js"></script> <script src="{{ site.cdn.js }}.iife.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{{ site.data.cdn['ie10-viewport-bug-workaround'] }}"></script>
<script> <script>
$('body').bootstrapMaterialDesign() $('body').bootstrapMaterialDesign()
</script> </script>
@ -78,8 +79,9 @@ Put it all together and your pages should look like this:
<!-- jQuery first, optional tether for tooltips, then Bootstrap and Material Design for Bootstrap JS. --> <!-- jQuery first, optional tether for tooltips, then Bootstrap and Material Design for Bootstrap JS. -->
<script src="{{ site.data.cdn.jquery }}.min.js"></script> <script src="{{ site.data.cdn.jquery }}.min.js"></script>
<script src="{{ site.data.cdn.tether }}.min.js"></script> <script src="{{ site.data.cdn.tether }}.min.js"></script>
<script src="{{ site.data.cdn.bootstrap }}.min.js"></script>
<script src="{{ site.cdn.js }}.iife.min.js"></script> <script src="{{ site.cdn.js }}.iife.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{{ site.data.cdn['ie10-viewport-bug-workaround'] }}"></script>
<script> <script>
$('body').bootstrapMaterialDesign() $('body').bootstrapMaterialDesign()
</script> </script>

View File

@ -31,24 +31,46 @@ let preset = Preset.baseline({
// When converting non-modular dependencies into usable ones using rollup-plugin-commonjs, if they don't have properly read exports add them here. // When converting non-modular dependencies into usable ones using rollup-plugin-commonjs, if they don't have properly read exports add them here.
let namedExports = {} let namedExports = {}
//namedExports[`${node_modules}/corejs-typeahead/dist/bloodhound.js`] = ['Bloodhound'] //namedExports[`${node_modules}/corejs-typeahead/dist/bloodhound.js`] = ['Bloodhound']
//namedExports[`${node_modules}/anchor-js/anchor.js`] = ['AnchorJS']
let rollupConfig = { let rollupConfig = {
debug: true,
options: {
external: [
'anchor-js',
'clipboard'
],
globals: {
'anchor-js': 'anchors',
clipboard: 'Clipboard'
}
},
commonjs: { commonjs: {
options: { options: {
namedExports: namedExports namedExports: namedExports,
} }
} }
} }
let rollups = [ let rollups = [
new RollupEs(gulp, preset, extend(true, {}, rollupConfig, {options: {dest: 'bootstrap-material-design.es.js'}})), new RollupEs(gulp, preset, extend(true, {}, rollupConfig, {options: {dest: 'bootstrap-material-design.es.js'}})),
new RollupUmd(gulp, preset, extend(true, {}, rollupConfig, {options: {dest: 'bootstrap-material-design.umd.js', moduleName: 'bootstrapMaterialDesign'}})), new RollupUmd(gulp, preset, extend(true, {}, rollupConfig, {
new RollupIife(gulp, preset, extend(true, {}, rollupConfig, {options: {dest: 'bootstrap-material-design.iife.js', moduleName: 'bootstrapMaterialDesign'}})), options: {
dest: 'bootstrap-material-design.umd.js',
moduleName: 'bootstrapMaterialDesign'
}
})),
new RollupIife(gulp, preset, extend(true, {}, rollupConfig, {
options: {
dest: 'bootstrap-material-design.iife.js',
moduleName: 'bootstrapMaterialDesign'
}
})),
] ]
let eslint = new EsLint(gulp, preset) let eslint = new EsLint(gulp, preset)
let scsslint = new ScssLint(gulp, preset) let scsslint = new ScssLint(gulp, preset)
let sass = new Sass(gulp, preset, {debug: true}) let sass = new Sass(gulp, preset)
let lint = [scsslint, eslint] let lint = [scsslint, eslint]
// instantiate ordered array of recipes (for each instantiation the tasks will be created e.g. sass and sass:watch) // instantiate ordered array of recipes (for each instantiation the tasks will be created e.g. sass and sass:watch)
@ -58,7 +80,8 @@ let recipes = [
[ [
sass, sass,
rollups rollups
] ],
new MinifyCss(gulp, preset)
] ]
// Simple helper to create the default and watch tasks as a sequence of the recipes already defined // Simple helper to create the default and watch tasks as a sequence of the recipes already defined
@ -66,3 +89,36 @@ new TaskSeries(gulp, 'default', recipes)
new TaskSeries(gulp, 'lint', lint) new TaskSeries(gulp, 'lint', lint)
new TaskSeries(gulp, 'js', [eslint, rollups]) new TaskSeries(gulp, 'js', [eslint, rollups])
new TaskSeries(gulp, 'css', [scsslint, sass]) new TaskSeries(gulp, 'css', [scsslint, sass])
let docsPreset = Preset.baseline({
javascripts: {
source: {options: {cwd: 'docs/assets/js/src'}},
watch: {options: {cwd: 'docs/assets/js/src'}},
test: {options: {cwd: 'docs/assets/js/tests'}},
dest: 'docs/dist'
},
stylesheets: {
source: {options: {cwd: 'docs/assets/scss'}},
watch: {options: {cwd: 'docs/assets/scss'}},
dest: 'docs/dist'
}
/*,
images: {
source: {options: {cwd: 'docs/assets/img'}},
watch: {options: {cwd: 'docs/assets/img'}},
dest: 'docs/dist'
} */
})
const docsConfig = {task: {prefix: 'docs:'}}
let docs = [
new EsLint(gulp, docsPreset, docsConfig),
new RollupIife(gulp, docsPreset, extend(true, {}, docsConfig, rollupConfig, {
options: {
dest: 'docs.iife.js',
moduleName: 'docs'
}
}))
]

View File

@ -9,6 +9,7 @@
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
import 'babel-polyfill/dist/polyfill' import 'babel-polyfill/dist/polyfill'
import 'bootstrap'
// invalidComponentMatches is currently disabled due to https://github.com/rollup/rollup/issues/428#issuecomment-170066452 // invalidComponentMatches is currently disabled due to https://github.com/rollup/rollup/issues/428#issuecomment-170066452
import Checkbox from './checkbox' import Checkbox from './checkbox'

View File

@ -38,9 +38,10 @@
"tether": "^1.2.0" "tether": "^1.2.0"
}, },
"devDependencies": { "devDependencies": {
"babel-preset-es2015": "^6.6.0",
"babel-eslint": "^5.0.0", "babel-eslint": "^5.0.0",
"babel-polyfill": "^6.6", "babel-polyfill": "^6.6",
"babel-preset-es2015": "^6.6.0",
"extend": "^3.0.0",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-pipeline": "^0.4" "gulp-pipeline": "^0.4"
}, },