mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-09 05:16:23 +10:00
feat: expose config.styl variables to style.styl (#727)
This commit is contained in:
@@ -476,6 +476,7 @@ $textColor = red
|
||||
|
||||
``` stylus
|
||||
// .vuepress/style.styl, your extra styles.
|
||||
// variables from config.styl can be used here
|
||||
#my-style {}
|
||||
```
|
||||
|
||||
|
||||
@@ -28,9 +28,10 @@ module.exports = async function prepare (sourceDir) {
|
||||
const hasUserOverride = fs.existsSync(overridePath)
|
||||
await writeTemp('override.styl', hasUserOverride ? `@import(${JSON.stringify(overridePath)})` : ``)
|
||||
|
||||
const configPath = require.resolve('../default-theme/styles/config.styl')
|
||||
const stylePath = path.resolve(sourceDir, '.vuepress/style.styl').replace(/[\\]+/g, '/')
|
||||
const hasUserStyle = fs.existsSync(stylePath)
|
||||
await writeTemp('style.styl', hasUserStyle ? `@import(${JSON.stringify(stylePath)})` : ``)
|
||||
await writeTemp('style.styl', hasUserStyle ? `@import(${JSON.stringify(configPath)})\n@import(${JSON.stringify(stylePath)})` : ``)
|
||||
|
||||
// Temporary tip, will be removed at next release.
|
||||
if (hasUserOverride && !hasUserStyle) {
|
||||
|
||||
Reference in New Issue
Block a user