Skip to content

can not override config.styl globally #2127

@fengxinming

Description

@fengxinming
  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

  1. create a file 'config.styl'
$textColor = #000000
  1. edit file '.vuepress/config.js`
{
  stylus: {
    import: ['config.styl']
  }
}

What is expected?

initialized $textColor #2c3e50 is replaced with #000000

What is actually happening?

nothing happens

Other relevant information

look up code in file @vuepress/core/lib/node/internal-plugins/palette/index.js

10    // 1. enable config.styl globally.
11    const configFile = ctx.getLibFilePath('client/style/config.styl')
12    if (!ctx.siteConfig.stylus) {
13      ctx.siteConfig.stylus = {
14        import: [configFile]
15      }
16    } else if (isPlainObject(ctx.siteConfig.stylus)) {
17      ctx.siteConfig.stylus.import = (ctx.siteConfig.stylus.import || []).concat([configFile])
18    }

I propose to amend the 17th lines of code

ctx.siteConfig.stylus.import = [configFile].concat(ctx.siteConfig.stylus.import || [])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions