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:
parent
408f1aa87d
commit
290a00e58f
@ -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,
|
||||
|
1
packages/mdx-deck/.gitignore
vendored
1
packages/mdx-deck/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.cache
|
||||
public
|
||||
static
|
||||
|
@ -1,2 +1,3 @@
|
||||
.cache
|
||||
public
|
||||
static
|
||||
|
@ -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',
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user