Permalink
Browse files

Fix for vendor files not working correctly with manifest

  • Loading branch information...
1 parent 87fa381 commit 0a46dc16a6a2725b22986bace15a9785d33e783d @BerkeleyTrue BerkeleyTrue committed Nov 11, 2015
Showing with 18 additions and 32 deletions.
  1. +1 −0 .gitignore
  2. +12 −27 gulpfile.js
  3. +2 −5 package.json
  4. +3 −0 webpack.config.js
View
@@ -44,6 +44,7 @@ public/js/commonFramework*
public/js/sandbox*
public/js/iFrameScripts*
public/js/plugin*
+public/js/vendor*
public/css/main*
server/rev-manifest.json
View
@@ -19,7 +19,7 @@ var Rx = require('rx'),
merge = require('merge-stream'),
// react app
- webpack = require('gulp-webpack'),
+ webpack = require('webpack-stream'),
webpackConfig = require('./webpack.config.js'),
webpackConfigNode = require('./webpack.config.node.js'),
@@ -356,40 +356,25 @@ function getFilesGlob(files) {
});
}
-gulp.task('vendor', ['js'], function() {
+gulp.task('js', function() {
var manifestName = 'js-manifest.json';
var dest = paths.publicJs;
- var vendorFiles = merge(
+ var jsFiles = merge(
+
gulp.src(getFilesGlob(paths.vendorMain))
.pipe(concat('vendor-main.js')),
+
gulp.src(paths.vendorChallenges)
.pipe(__DEV__ ? gutil.noop() : uglify())
- .pipe(concat('vendor-challenges.js'))
- );
+ .pipe(concat('vendor-challenges.js')),
- return vendorFiles.pipe(gulp.dest(dest))
- // create registry file
- .pipe(rev())
- // copy revisioned assets to dest
- .pipe(gulp.dest(dest))
- // create manifest file
- .pipe(rev.manifest(manifestName))
- .pipe(delRev(
- dest,
- manifestName
- ))
- // copy manifest file to dest
- .pipe(gulp.dest(paths.manifest));
-});
-
-gulp.task('js', function() {
- var manifestName = 'js-manifest.json';
- var dest = paths.publicJs;
+ gulp.src(paths.js)
+ .pipe(plumber({ errorHandler: errorHandler }))
+ .pipe(__DEV__ ? gutil.noop() : uglify())
+ );
- return gulp.src(paths.js)
- .pipe(plumber({ errorHandler: errorHandler }))
- .pipe(__DEV__ ? gutil.noop() : uglify())
+ return jsFiles
.pipe(gulp.dest(dest))
// create registry file
.pipe(rev())
@@ -444,7 +429,7 @@ function buildManifest() {
.pipe(gulp.dest('server/'));
}
-var buildDependents = ['less', 'js', 'dependents', 'vendor'];
+var buildDependents = ['less', 'js', 'dependents'];
gulp.task('build-manifest', buildDependents, function() {
return buildManifest();
View
@@ -10,7 +10,7 @@
"create-rev": "test ! -e server/rev-manifest.json && echo '\n\ncreating manifest\n\n' && touch server/rev-manifest.json && echo '{}' >> server/rev-manifest.json",
"build": "NODE_ENV=production gulp build -p",
"start": "babel-node server/server.js",
- "prestart-production": "bower cache clean && bower install && gulp build",
+ "prestart-production": "bower cache clean && bower install && gulp build -p",
"start-production": "node pm2Start",
"lint": "npm run lint-js && npm run lint-json",
"lint-challenges": "jsonlint -q seed/challenges/*.json",
@@ -122,12 +122,9 @@
"url-regex": "^3.0.0",
"validator": "^4.2.1",
"webpack": "^1.9.12",
+ "webpack-stream": "^2.1.1",
"xss-filters": "^1.2.6",
-<<<<<<< HEAD
"yargs": "^3.30.0"
-=======
- "yargs": "^3.29.0"
->>>>>>> bundle vendor files
},
"devDependencies": {
"blessed": "~0.1.81",
View
@@ -1,3 +1,4 @@
+var webpack = require('webpack');
var path = require('path');
var webpack = require('webpack');
@@ -31,6 +32,8 @@ module.exports = {
]
},
plugins: [
+ new webpack.optimize.DedupePlugin(),
+ new webpack.optimize.OccurenceOrderPlugin(true),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(__DEV__ ? 'development' : 'production')

0 comments on commit 0a46dc1

Please sign in to comment.