fix(build): commonjs fix, put html files into the distribution
MODIFY
gulpfile.js
gulpfile.js
@@ -39,7 +39,7 @@ const cloptions = require('minimist')(process.argv.slice(2), {
* BrowserSync
*/
-gulp.task('browser-sync', () => {
+gulp.task('browser-sync', ['build:dev'], () => {
browserSync.init({
logPrefix: 'Carbon Components',
open: false,
@@ -59,6 +59,7 @@ gulp.task('clean', () => del([
'es',
'umd',
'scripts',
+ 'html',
'dist',
'demo/**/*.{js,map}',
'!demo/js/demo-switcher.js',
@@ -186,6 +187,13 @@ gulp.task('sass:source', () => {
.pipe(gulp.dest('sass'));
});
+gulp.task('html:source', () => {
+ const srcFiles = './src/components/**/*.html';
+
+ return gulp.src(srcFiles)
+ .pipe(gulp.dest('html'));
+});
+
/**
* Lint
*/
@@ -245,7 +253,7 @@ gulp.task('build:scripts', ['scripts:umd', 'scripts:es', 'scripts:compiled']);
gulp.task('build:styles', ['sass:compiled', 'sass:source']);
// Mapped to npm run build
-gulp.task('build', ['build:scripts', 'build:styles']);
+gulp.task('build', ['build:scripts', 'build:styles', 'html:source']);
// For demo environment
gulp.task('build:dev', ['sass:dev', 'scripts:dev']);

MODIFY
package.json
package.json
"npm": "~3.0.0"
},
"dependencies": {
- "carbon-icons": "5.0.1",
"adaro": "1.0.4",
"bluebird": "~3.1.1",
+ "carbon-icons": "5.0.1",
"eslint": "^3.0.0",
"express": "4.13.4",
"globby": "4.0.0",
- "lodash-es": "^4.17.4"
+ "lodash.debounce": "^4.0.8"
},
"devDependencies": {
"babel-core": "^6.22.0",
"scripts/**/*",
"sass/**/*",
"css/**/*",
+ "html/**/*",
"src/**/*"
],
"keywords": [

MODIFY
src/components/detail-page-header/detail-page-header.js
src/components/detail-page-header/detail-page-header.js
-import debounce from 'lodash-es/debounce';
+import debounce from 'lodash.debounce';
import mixin from '../../globals/js/misc/mixin';
import createComponent from '../../globals/js/mixins/create-component';
import initComponentBySearch from '../../globals/js/mixins/init-component-by-search';

MODIFY
tools/rollup.config.js
tools/rollup.config.js
+const commonjs = require('rollup-plugin-commonjs');
const resolve = require('rollup-plugin-node-resolve');
const babel = require('rollup-plugin-babel');
@@ -7,8 +8,16 @@ module.exports = {
moduleName: 'CarbonComponents',
plugins: [
resolve(),
+ commonjs({
+ include: 'node_modules/**',
+ sourceMap: false,
+ }),
babel({
- exclude: 'node_modules/**', // only transpile our source code
+ exclude:
+ [
+ 'node_modules/**',
+ ], // only transpile our source code
+
}),
],
dest: 'scripts/carbon-components.js',

fix(build): commonjs fix, put html files into the distribution (#2452)