update design bundle for router
This commit is contained in:
@@ -3,6 +3,8 @@ import yargs from 'yargs';
|
||||
import webpack from 'webpack';
|
||||
import gutil from 'gulp-util';
|
||||
|
||||
import FsHelper from './server/lib/fs_helper';
|
||||
import ComponentMapWriter from './server/lib/tasks/component_map_writer';
|
||||
import DB from './server/config/database';
|
||||
import {PowerDataSeed, HouseSeed} from './server/lib/tasks/seed_data';
|
||||
import rtCompile from './server/lib/tasks/react_template_compile';
|
||||
@@ -41,35 +43,38 @@ gulp.task('build', function(done) {
|
||||
gulpCopy = require('gulp-copy');
|
||||
|
||||
if (yargs.argv.design){
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'design';
|
||||
process.env.NODE_ENV = 'design';
|
||||
} else {
|
||||
throw new gutil.PluginError("webpack", "Must include '--production' or '--design' option.");
|
||||
throw new gutil.PluginError("webpack", "Must include '--design' option.");
|
||||
}
|
||||
config = require(`${__dirname}/client/config/${process.env.NODE_ENV}/webpack.js`);
|
||||
// run webpack
|
||||
webpack(config, function(err, stats) {
|
||||
if(err) throw new gutil.PluginError("webpack", err);
|
||||
gutil.log("[webpack]", stats.toString({
|
||||
// output options
|
||||
}));
|
||||
if (yargs.argv.design){
|
||||
gulp.src([
|
||||
`client/app.scss`
|
||||
]).pipe(gulpCopy(`client/build/design/dashboard`, {prefix: 1}));
|
||||
gulp.src([
|
||||
`client/dashboard/layout/layout.rt`,
|
||||
`client/dashboard/layout/layout.scss`,
|
||||
]).pipe(gulpCopy(`client/build/design/dashboard/layout`, {prefix: 3}));
|
||||
gulp.src([
|
||||
`client/dashboard/energy/energy.rt`,
|
||||
`client/dashboard/energy/energy.scss`,
|
||||
]).pipe(gulpCopy(`client/build/design/dashboard/energy`, {prefix: 3}));
|
||||
gulp.src([
|
||||
`client/dashboard/power/power.rt`,
|
||||
`client/dashboard/power/power.scss`,
|
||||
]).pipe(gulpCopy(`client/build/design/dashboard/power`, {prefix: 3}));
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
// write template map.
|
||||
ComponentMapWriter.write(__dirname + '/client/config/design/component_map.js')
|
||||
.then(()=>{
|
||||
|
||||
// build assets/app.js and assets/style.css
|
||||
config = require(`${__dirname}/client/config/${process.env.NODE_ENV}/webpack.js`);
|
||||
webpack(config, function(err, stats) {
|
||||
if(err) throw new gutil.PluginError("webpack", err);
|
||||
gutil.log("[webpack]", stats.toString({}));
|
||||
|
||||
if (yargs.argv.design){
|
||||
// copy all react templates and their styles sheets into build/design/dashboard.
|
||||
gulp.src([
|
||||
`client/app.scss`
|
||||
]).pipe(gulpCopy(`client/build/design/dashboard`, {prefix: 1}));
|
||||
|
||||
FsHelper.walk('client/dashboard', (err, files)=>{
|
||||
var files_to_copy = files.filter((file)=>{
|
||||
return /\.(rt|scss)$/.test(file)
|
||||
});
|
||||
gulp.src(files_to_copy)
|
||||
.pipe(gulpCopy('client/build/design/dashboard', {prefix: 2}));
|
||||
done()
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user