mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-09 11:16:39 -05:00
Don't include both the production and dev versions of vue when targeting one or the other
This commit is contained in:
parent
d96f37737a
commit
ab3803fe59
4 changed files with 102 additions and 16 deletions
50
gulpfile.js
vendored
50
gulpfile.js
vendored
|
@ -2,6 +2,7 @@
|
||||||
const gulp = require("gulp"),
|
const gulp = require("gulp"),
|
||||||
minimist = require("minimist"),
|
minimist = require("minimist"),
|
||||||
log = require("fancy-log"),
|
log = require("fancy-log"),
|
||||||
|
insert = require("gulp-insert"),
|
||||||
plumber = require("gulp-plumber"),
|
plumber = require("gulp-plumber"),
|
||||||
concat = require("gulp-concat");
|
concat = require("gulp-concat");
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ const sassOutputStyle = isProduction ? "compressed" : "expanded",
|
||||||
vuePaths = [ "./bower_components", "./node_modules", "./resources/components", "./resources/assets/js" ];
|
vuePaths = [ "./bower_components", "./node_modules", "./resources/components", "./resources/assets/js" ];
|
||||||
|
|
||||||
// Javascript files for the public site
|
// Javascript files for the public site
|
||||||
const jsPublic = [ "resources/assets/js/app.js" ];
|
const jsPublic = "resources/assets/js/app.js";
|
||||||
|
|
||||||
// Javascript libraries for the public site
|
// Javascript libraries for the public site
|
||||||
const jsPublicLibs = [
|
const jsPublicLibs = [
|
||||||
|
@ -118,21 +119,42 @@ function processCSS(outputFilename, inputFiles) {
|
||||||
|
|
||||||
// Process vue
|
// Process vue
|
||||||
function processVue(outputFilename, inputFile) {
|
function processVue(outputFilename, inputFile) {
|
||||||
const javascript = browserify({
|
const processedDir = "storage/app/",
|
||||||
entries: [ inputFile ],
|
processedFile = `__${outputFilename}.js`;
|
||||||
paths: vuePaths
|
|
||||||
}).transform("babelify")
|
|
||||||
.transform(vueify)
|
|
||||||
.bundle()
|
|
||||||
.on("error", handleError)
|
|
||||||
.pipe(source(`${outputFilename}.js`))
|
|
||||||
.pipe(buffer());
|
|
||||||
|
|
||||||
if (isProduction) {
|
const preProcess = () => {
|
||||||
javascript.pipe(stripDebug()).pipe(uglify().on("error", handleError));
|
const javascript = gulp.src([ inputFile ]);
|
||||||
}
|
|
||||||
|
|
||||||
return javascript.pipe(gulp.dest("public/js/"));
|
if (isProduction) {
|
||||||
|
javascript.pipe(insert.transform(function(contents) {
|
||||||
|
return contents.replace(/vue\.js/, "vue.min.js");
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return javascript.pipe(concat(processedFile))
|
||||||
|
.pipe(gulp.dest(processedDir));
|
||||||
|
};
|
||||||
|
|
||||||
|
const process = () => {
|
||||||
|
const javascript = browserify({
|
||||||
|
entries: [ processedDir + processedFile ],
|
||||||
|
paths: vuePaths
|
||||||
|
}).transform("babelify")
|
||||||
|
.transform(vueify)
|
||||||
|
.bundle()
|
||||||
|
.on("error", handleError)
|
||||||
|
.pipe(source(`${outputFilename}.js`))
|
||||||
|
.pipe(buffer());
|
||||||
|
|
||||||
|
if (isProduction) {
|
||||||
|
javascript.pipe(stripDebug()).pipe(uglify().on("error", handleError));
|
||||||
|
}
|
||||||
|
|
||||||
|
return javascript.pipe(gulp.dest("public/js/"));
|
||||||
|
};
|
||||||
|
|
||||||
|
preProcess();
|
||||||
|
return process();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process javascript
|
// Process javascript
|
||||||
|
|
63
package-lock.json
generated
63
package-lock.json
generated
|
@ -4136,6 +4136,38 @@
|
||||||
"vinyl": "^2.0.0"
|
"vinyl": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"gulp-insert": {
|
||||||
|
"version": "0.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/gulp-insert/-/gulp-insert-0.5.0.tgz",
|
||||||
|
"integrity": "sha1-MjE/E+SiPPWsylzl8MCAkjx3hgI=",
|
||||||
|
"requires": {
|
||||||
|
"readable-stream": "^1.0.26-4",
|
||||||
|
"streamqueue": "0.0.6"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"isarray": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||||
|
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||||
|
},
|
||||||
|
"readable-stream": {
|
||||||
|
"version": "1.1.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
|
||||||
|
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
|
||||||
|
"requires": {
|
||||||
|
"core-util-is": "~1.0.0",
|
||||||
|
"inherits": "~2.0.1",
|
||||||
|
"isarray": "0.0.1",
|
||||||
|
"string_decoder": "~0.10.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"string_decoder": {
|
||||||
|
"version": "0.10.31",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||||
|
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"gulp-plumber": {
|
"gulp-plumber": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/gulp-plumber/-/gulp-plumber-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/gulp-plumber/-/gulp-plumber-1.2.1.tgz",
|
||||||
|
@ -8041,6 +8073,37 @@
|
||||||
"limiter": "^1.0.5"
|
"limiter": "^1.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"streamqueue": {
|
||||||
|
"version": "0.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/streamqueue/-/streamqueue-0.0.6.tgz",
|
||||||
|
"integrity": "sha1-ZvX17JTpuK8knkrsLdH3Qb/pTeM=",
|
||||||
|
"requires": {
|
||||||
|
"readable-stream": "^1.0.26-2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"isarray": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||||
|
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||||
|
},
|
||||||
|
"readable-stream": {
|
||||||
|
"version": "1.1.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
|
||||||
|
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
|
||||||
|
"requires": {
|
||||||
|
"core-util-is": "~1.0.0",
|
||||||
|
"inherits": "~2.0.1",
|
||||||
|
"isarray": "0.0.1",
|
||||||
|
"string_decoder": "~0.10.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"string_decoder": {
|
||||||
|
"version": "0.10.31",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||||
|
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"strict-uri-encode": {
|
"strict-uri-encode": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"gulp-babel": "^8.0.0",
|
"gulp-babel": "^8.0.0",
|
||||||
"gulp-clean-css": "^4.2.0",
|
"gulp-clean-css": "^4.2.0",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
|
"gulp-insert": "^0.5.0",
|
||||||
"gulp-plumber": "^1.2.1",
|
"gulp-plumber": "^1.2.1",
|
||||||
"gulp-postcss": "^8.0.0",
|
"gulp-postcss": "^8.0.0",
|
||||||
"gulp-sass": "^4.0.2",
|
"gulp-sass": "^4.0.2",
|
||||||
|
|
4
resources/assets/js/app.js
vendored
4
resources/assets/js/app.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
// Determine whether to use vue.js in debug or production mode
|
// Initialize Vue
|
||||||
const Vue = env.debug ? require("vue/dist/vue.js") : require("vue/dist/vue.min.js");
|
const Vue = require("vue/dist/vue.js");
|
||||||
|
|
||||||
// Import plugins
|
// Import plugins
|
||||||
import VueRouter from "vue-router";
|
import VueRouter from "vue-router";
|
||||||
|
|
Loading…
Reference in a new issue