mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-21 15:42:31 -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
26
gulpfile.js
vendored
26
gulpfile.js
vendored
|
@ -2,6 +2,7 @@
|
|||
const gulp = require("gulp"),
|
||||
minimist = require("minimist"),
|
||||
log = require("fancy-log"),
|
||||
insert = require("gulp-insert"),
|
||||
plumber = require("gulp-plumber"),
|
||||
concat = require("gulp-concat");
|
||||
|
||||
|
@ -40,7 +41,7 @@ const sassOutputStyle = isProduction ? "compressed" : "expanded",
|
|||
vuePaths = [ "./bower_components", "./node_modules", "./resources/components", "./resources/assets/js" ];
|
||||
|
||||
// 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
|
||||
const jsPublicLibs = [
|
||||
|
@ -118,8 +119,25 @@ function processCSS(outputFilename, inputFiles) {
|
|||
|
||||
// Process vue
|
||||
function processVue(outputFilename, inputFile) {
|
||||
const processedDir = "storage/app/",
|
||||
processedFile = `__${outputFilename}.js`;
|
||||
|
||||
const preProcess = () => {
|
||||
const javascript = gulp.src([ inputFile ]);
|
||||
|
||||
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: [ inputFile ],
|
||||
entries: [ processedDir + processedFile ],
|
||||
paths: vuePaths
|
||||
}).transform("babelify")
|
||||
.transform(vueify)
|
||||
|
@ -133,6 +151,10 @@ function processVue(outputFilename, inputFile) {
|
|||
}
|
||||
|
||||
return javascript.pipe(gulp.dest("public/js/"));
|
||||
};
|
||||
|
||||
preProcess();
|
||||
return process();
|
||||
}
|
||||
|
||||
// Process javascript
|
||||
|
|
63
package-lock.json
generated
63
package-lock.json
generated
|
@ -4136,6 +4136,38 @@
|
|||
"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": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-plumber/-/gulp-plumber-1.2.1.tgz",
|
||||
|
@ -8041,6 +8073,37 @@
|
|||
"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": {
|
||||
"version": "1.1.0",
|
||||
"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-clean-css": "^4.2.0",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-insert": "^0.5.0",
|
||||
"gulp-plumber": "^1.2.1",
|
||||
"gulp-postcss": "^8.0.0",
|
||||
"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
|
||||
const Vue = env.debug ? require("vue/dist/vue.js") : require("vue/dist/vue.min.js");
|
||||
// Initialize Vue
|
||||
const Vue = require("vue/dist/vue.js");
|
||||
|
||||
// Import plugins
|
||||
import VueRouter from "vue-router";
|
||||
|
|
Loading…
Reference in a new issue