converted docs to use rollup and made docs-js process similar to dist-js

This commit is contained in:
Kevin Ross 2016-01-04 10:52:35 -06:00
parent 9a4158540b
commit 97c952746f
9 changed files with 58 additions and 105 deletions

View File

@ -99,11 +99,11 @@ module.exports = function (grunt) {
return result; return result;
} }
Object.keys(configBridge.paths).forEach(function (key) { //Object.keys(configBridge.paths).forEach(function (key) {
configBridge.paths[key].forEach(function (val, i, arr) { // configBridge.paths[key].forEach(function (val, i, arr) {
arr[i] = path.join('./docs/assets', val); // arr[i] = path.join('./docs/assets', val);
}); // });
}); //});
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
@ -120,6 +120,7 @@ module.exports = function (grunt) {
clean: { clean: {
dist: 'dist', dist: 'dist',
'dist-js': 'dist/js', 'dist-js': 'dist/js',
'docs-dist-js': 'docs/dist/js',
docs: 'docs/dist' docs: 'docs/dist'
}, },
@ -168,7 +169,7 @@ module.exports = function (grunt) {
test: { test: {
src: 'js/tests/unit/*.js' src: 'js/tests/unit/*.js'
}, },
assets: { docs: {
options: { options: {
requireCamelCaseOrUpperCaseIdentifiers: null requireCamelCaseOrUpperCaseIdentifiers: null
}, },
@ -216,31 +217,22 @@ module.exports = function (grunt) {
'dist/js/bootstrap-material-design.umd.min.js': 'dist/js/bootstrap-material-design.umd.js', 'dist/js/bootstrap-material-design.umd.min.js': 'dist/js/bootstrap-material-design.umd.js',
'dist/js/bootstrap-material-design.es6.min.js': 'dist/js/bootstrap-material-design.es6.js' 'dist/js/bootstrap-material-design.es6.min.js': 'dist/js/bootstrap-material-design.es6.js'
} }
} },
//'systemjs-all': {
// src: 'dist/js/system-all.js',
// dest: 'dist/js/system-all.min.js'
//},
//'commonjs-all': {
// src: 'dist/js/common-all.js',
// dest: 'dist/js/common-all.min.js'
//},
//'systemjs-all': { 'docs-vendor': {
// src: 'dist/js/system-all.js', options: {
// dest: 'dist/js/system-all.min.js' compress: false
//}, },
//'commonjs-all': { //src: configBridge.paths.docsJs,
// src: 'dist/js/common-all.js', src: 'docs/assets/js/vendor/*.js',
// dest: 'dist/js/common-all.min.js' //dest: 'docs/assets/js/docs.min.js'
//}, dest: 'docs/dist/js/docs-vendor.min.js'
// docs: { },
// options: { docs: {
// compress: false files: {
// }, 'docs/dist/js/docs.iife.min.js': 'docs/dist/js/docs.iife.js'
// src: configBridge.paths.docsJs, }
// dest: 'docs/assets/js/docs.min.js' }
// }
}, },
qunit: { qunit: {
@ -341,21 +333,6 @@ module.exports = function (grunt) {
}, },
copy: { copy: {
'dist-to-docs': {
expand: true,
cwd: 'dist/',
src: [
'**/*',
'!js/demoduled',
'!js/demoduled/**/*',
'!js/umd',
'!js/umd/**/*',
//'!js/systemjs',
//'!js/systemjs/**/*',
'!js/npm.js'
],
dest: 'docs/dist/'
},
'bs-docs-js-vendor': { 'bs-docs-js-vendor': {
expand: true, expand: true,
cwd: '../bootstrap/docs/assets/js/vendor', cwd: '../bootstrap/docs/assets/js/vendor',
@ -515,14 +492,17 @@ module.exports = function (grunt) {
npmUpdate: { npmUpdate: {
command: 'npm update' command: 'npm update'
}, },
'rollup-docs-iife': {
command: 'rollup -c grunt/rollup.docs.iife.config.js'
},
'rollup-iife': { 'rollup-iife': {
command: 'rollup -c rollup.iife.config.js' command: 'rollup -c grunt/rollup.iife.config.js'
}, },
'rollup-umd': { 'rollup-umd': {
command: 'rollup -c rollup.umd.config.js' command: 'rollup -c grunt/rollup.umd.config.js'
}, },
'rollup-es6': { 'rollup-es6': {
command: 'rollup -c rollup.es6.config.js' command: 'rollup -c grunt/rollup.es6.config.js'
} }
}, },
@ -622,9 +602,17 @@ module.exports = function (grunt) {
'exec:rollup-umd', 'exec:rollup-umd',
'exec:rollup-es6', 'exec:rollup-es6',
'stamp', 'stamp',
'uglify:dist', 'uglify:dist'
'copy:dist-to-docs'
]); ]);
grunt.registerTask('docs-js', [
'clean:docs-dist-js',
'eslint',
'jscs:docs',
'exec:rollup-docs-iife',
'uglify:docs',
'uglify:docs-vendor'
]);
grunt.registerTask('test-scss', ['scsslint']); grunt.registerTask('test-scss', ['scsslint']);
@ -666,14 +654,7 @@ module.exports = function (grunt) {
'copy:bs-docs-plugins' 'copy:bs-docs-plugins'
]); ]);
grunt.registerTask('docs-css', ['sass:docs', 'postcss:docs', 'postcss:examples', 'csscomb:docs', 'csscomb:examples', 'cssmin:docs']); grunt.registerTask('docs-css', ['sass:docs', 'postcss:docs', 'postcss:examples', 'csscomb:docs', 'csscomb:examples', 'cssmin:docs']);
grunt.registerTask('lint-docs-js', ['jscs:assets']);
grunt.registerTask('docs-js', [
'babel:docs',
'lineremover:docs',
'uglify:docs',
'lint-docs-js',
'copy:dist-to-docs'
]);
grunt.registerTask('docs', ['clean:docs', 'docs-css', 'docs-js']); grunt.registerTask('docs', ['clean:docs', 'docs-css', 'docs-js']);
//------ //------

View File

@ -20,17 +20,11 @@
<script src="{{ site.data.cdn.tether }}"></script> <script src="{{ site.data.cdn.tether }}"></script>
<script src="{{ site.data.cdn.bootstrap }}"></script> <script src="{{ site.data.cdn.bootstrap }}"></script>
<script src="{{ site.baseurl }}/dist/js/docs-vendor.min.js"></script>
{% if site.data.minified %} {% if site.data.minified %}
<script src="{{ site.baseurl }}/dist/js/{{ site.data.name }}.min.js"></script> <script src="{{ site.baseurl }}/dist/js/docs.iife.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/docs.min.js"></script>
{% else %} {% else %}
{% for file in site.data.configBridge.paths.coreJs %} <script src="{{ site.baseurl }}/dist/js/docs.iife.js"></script>
<script src="{{ site.baseurl }}/{{ file }}"></script>
{% endfor %}
{% for file in site.data.configBridge.paths.docsJs %}
<script src="{{ site.baseurl }}/{{ file }}"></script>
{% endfor %}
{% endif %} {% endif %}
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
@ -38,7 +32,8 @@
<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" %}
<script src="{{ site.baseurl }}/assets/js/vendor/jekyll-search.min.js"></script> <!--already in docs-vendor.js -->
<!--<script src="{{ site.baseurl }}/assets/js/vendor/jekyll-search.min.js"></script>-->
<script> <script>
SimpleJekyllSearch.init({ SimpleJekyllSearch.init({

View File

@ -1,7 +1,8 @@
import 'babel-polyfill' //import 'babel-polyfill'
import Style from './style' import Style from './style'
import Clipboard from 'clipboard' import Clipboard from 'clipboard'
import anchors from 'anchor' import anchors from 'anchor'
//import mdb from '../../../../js/src/index' // eslint-disable-line no-unused-vars
class Application { class Application {

View File

@ -18,37 +18,5 @@
"bootstrapMaterialDesign.js", "bootstrapMaterialDesign.js",
"index.js" "index.js"
] ]
},
"docs": {
"files": [
"style.js",
"application.js"
]
},
"paths": {
"docsJs": [
"../assets/js/vendor/anchor.min.js",
"../assets/js/vendor/clipboard.min.js",
"../assets/js/vendor/holder.min.js",
"../assets/js/dist/style.js",
"../assets/js/dist/application.js"
],
"coreJs": [
"../dist/js/demoduled/baseInput.js",
"../dist/js/demoduled/baseSelection.js",
"../dist/js/demoduled/autofill.js",
"../dist/js/demoduled/bootstrapMaterialDesign.js",
"../dist/js/demoduled/checkbox.js",
"../dist/js/demoduled/checkboxInline.js",
"../dist/js/demoduled/file.js",
"../dist/js/demoduled/text.js",
"../dist/js/demoduled/textarea.js",
"../dist/js/demoduled/select.js",
"../dist/js/demoduled/radio.js",
"../dist/js/demoduled/radioInline.js",
"../dist/js/demoduled/ripples.js",
"../dist/js/demoduled/switch.js",
"../dist/js/demoduled/util.js"
]
} }
} }

View File

@ -0,0 +1,8 @@
import config from './rollup.config.js';
config.format = 'iife';
config.entry = 'docs/assets/js/src/index.js',
config.dest = 'docs/dist/js/docs.iife.js';
export default config;

View File

@ -1,4 +1,4 @@
import config from './rollup.config'; import config from './rollup.config.js';
config.format = 'es6'; config.format = 'es6';
config.dest = 'dist/js/bootstrap-material-design.es6.js'; config.dest = 'dist/js/bootstrap-material-design.es6.js';

View File

@ -1,4 +1,4 @@
import config from './rollup.config'; import config from './rollup.config.js';
config.format = 'iife'; config.format = 'iife';
config.dest = 'dist/js/bootstrap-material-design.iife.js'; config.dest = 'dist/js/bootstrap-material-design.iife.js';

View File

@ -1,8 +1,8 @@
import config from './rollup.config'; import config from './rollup.config.js';
config.format = 'umd'; config.format = 'umd';
config.moduleName = 'bootstrapMaterialDesign'; //config.moduleName = 'bootstrapMaterialDesign';
config.dest = 'dist/js/bootstrap-material-design.umd.js'; config.dest = 'dist/js/bootstrap-material-design.umd.js';
export default config; export default config;