Skip to content

Commit 0f1c01c

Browse files
author
Barthelemy Ledoux
committed
feat: vue-live layout configurability
1 parent 1bc712c commit 0f1c01c

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

chainWebpack.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
module.exports = function chainWebpack(config) {
2-
config.resolve.alias.set("vue$", "vue/dist/vue.esm.js");
1+
const path = require("path");
2+
3+
module.exports = options => {
4+
const layoutPath = options.layout || path.resolve(__dirname, "./layout.vue");
5+
return function(config) {
6+
config.resolve.alias
7+
.set("vue$", "vue/dist/vue.esm.js")
8+
.set("vuepress-plugin-live/live-layout", layoutPath);
9+
};
310
};

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ const chainWebpack = require("./chainWebpack");
22
const enhanceAppFiles = require("./enhanceAppFiles");
33
const chainMarkdown = require("./markDownPlugin");
44

5-
module.exports = () => {
5+
module.exports = (options, app, plugin) => {
66
return {
77
name: "vuepress-plugin-live",
8-
chainWebpack,
8+
chainWebpack: chainWebpack(options),
99
enhanceAppFiles,
1010
chainMarkdown
1111
};

vueLiveWithLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import layout from "./layout.vue";
1+
import layout from "vuepress-plugin-live/live-layout";
22

33
// vuepress is compiled in both node and non-node models
44
// it needs a "global" variable to make buble work.

0 commit comments

Comments
 (0)