1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-09-11 06:35:24 +03:00

Symlink static directory in CLI

This commit is contained in:
Brent Jackson 2020-02-17 16:50:35 -05:00
parent 408f1aa87d
commit 290a00e58f
4 changed files with 33 additions and 0 deletions

View File

@ -7,6 +7,22 @@ const remarkPlugins = [
require('remark-emoji'),
]
exports.onPreBootstrap = ({}, opts = {}) => {
opts.dirname = opts.dirname || __dirname
const staticSourceDir = path.join(opts.dirname, 'static')
const hasStaticDir = fs.existsSync(staticSourceDir)
if (fs.existsSync('./static')) {
// remove temp directory
fs.unlinkSync('./static')
}
if (hasStaticDir) {
// link to source static directory
fs.symlinkSync(staticSourceDir, './static')
}
}
exports.onCreateWebpackConfig = ({
stage,
rules,

View File

@ -1,2 +1,3 @@
.cache
public
static

View File

@ -1,2 +1,3 @@
.cache
public
static

View File

@ -1,4 +1,7 @@
const path = require('path')
const src = process.env.__SRC__
const dirname = path.dirname(src)
module.exports = {
plugins: [
@ -6,6 +9,18 @@ module.exports = {
resolve: '@mdx-deck/gatsby-plugin',
options: {
path: src,
dirname,
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: dirname,
ignore: [
'node_modules',
'public',
'.cache',
]
},
},
{