Skip to content

Commit

Permalink
feat: expose config.styl variables to style.styl (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
ycmjason authored and ulivz committed Aug 11, 2018
1 parent f9de5e2 commit 0bc2b51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/default-theme-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ $textColor = red

``` stylus
// .vuepress/style.styl, your extra styles.
// variables from config.styl can be used here
#my-style {}
```

Expand Down
3 changes: 2 additions & 1 deletion lib/prepare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0bc2b51

Please sign in to comment.