From 5723b1b76103a69239c6704bb768b3211ef4b58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 30 Oct 2020 18:11:54 +0100 Subject: [PATCH] open files in vscode in development --- docs/gridsome.client.js | 8 ++++++++ docs/gridsome.server.js | 4 ++++ docs/src/layouts/App/index.vue | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/docs/gridsome.client.js b/docs/gridsome.client.js index 65d2f3f2..6c5bcc17 100644 --- a/docs/gridsome.client.js +++ b/docs/gridsome.client.js @@ -1,5 +1,13 @@ export default function (Vue, options, context) { + Vue.mixin({ + data() { + return { + cwd: options.cwd, + } + }, + }) + context.router.afterEach(to => { if (to.hash) { setTimeout(() => { diff --git a/docs/gridsome.server.js b/docs/gridsome.server.js index 24b1b86b..214db742 100644 --- a/docs/gridsome.server.js +++ b/docs/gridsome.server.js @@ -52,6 +52,10 @@ const globby = require('globby') module.exports = function (api) { + api.setClientOptions({ + cwd: process.cwd(), + }) + api.loadSource(({ addCollection }) => { const appCollection = addCollection({ typeName: 'Package' }) diff --git a/docs/src/layouts/App/index.vue b/docs/src/layouts/App/index.vue index 06a50f55..c3bb8eaa 100644 --- a/docs/src/layouts/App/index.vue +++ b/docs/src/layouts/App/index.vue @@ -214,6 +214,10 @@ export default { const { currentPath } = this const filePath = currentPath === '' ? '/introduction' : currentPath + if (process.env.NODE_ENV === 'development') { + return `vscode://file${this.cwd}/src/docPages${filePath}.md` + } + return `https://github.com/ueberdosis/tiptap-next/blob/main/docs/src/docPages${filePath}.md` }, },