Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug overriding default values in css #639

Closed
ksacks opened this issue Jul 8, 2018 · 3 comments
Closed

Bug overriding default values in css #639

ksacks opened this issue Jul 8, 2018 · 3 comments
Labels
priority: high High priority issue type: bug Something isn't working

Comments

@ksacks
Copy link

ksacks commented Jul 8, 2018

Bug report

Version

0.11.0

Steps to reproduce

1 - Override default theme css variable value (.vuepress/override.styl)

// showing default values
$accentColor = #ff0000
$textColor = #000000
$borderColor = #eaecef
$codeBgColor = #282c34

2 - Changes don't apply. Seems like in the latest version, whilst correcting the duplicate css override, the default values are set last and therefore not overriding the variable values before these values are used.

What is expected?

Default theme css values should be applied

What is actually happening?

Default theme css values are not applied

Other relevant information

  • Your OS: Kubuntu 18.04
  • Node.js version: 8.10.0
  • Browser version: Chromium 66.0.3359.181
  • Is this a global or local install? Global
  • Which package manager did you use for the install? Npm
@ulivz ulivz added type: bug Something isn't working priority: high High priority issue labels Jul 9, 2018
@ulivz
Copy link
Member

ulivz commented Jul 9, 2018

Thanks for reporting that, we will release a new version to fix that for that later today.

@ulivz
Copy link
Member

ulivz commented Jul 9, 2018

Consider we can open a new API index.styl, and let override.styl return to the old behavior.

And we'll document this:

override.styl should be only used in overriding default theme's global stylus variables (See: #637). If you wrote extra styles in the past, e.g.

// override.styl.

$textColor = red

#my-style {}

It's recommended to separate the style part to index.styl.

// override.styl, will be mounted immediately after the default configuration, but before all styles.

$textColor = red
// index.styl, mounted after all styles.

#my-style {}

With that we'll have no any breaking changes.

@ksacks
Copy link
Author

ksacks commented Jul 9, 2018

Seems like a good solution !

Maybe having explicit filenames would help user not misunderstand ?

  • variables.styl (for overriding default values)
  • styles.styl or custom.styl (for custom styles exclusively)

Or even folder based and parsed for all files inside the folders ?

  • .vuepress/variables
  • .vuepress/styles

Or a mix of both :

  • .vuepress/override.styl (for theme variable values)
  • .vuepress/styles (folder for all custom styles)

@ulivz ulivz closed this as completed in c006fed Jul 12, 2018
ulivz added a commit that referenced this issue Jul 12, 2018
1. Fixed overriding css doesn't work at 0.11.0 (close: #639)

2. Split override.styl into two APIs: override.styl and style.styl, the former will focus on ONLY the style constants override, while the latter will focus on styles override or custom styles. See also: https://vuepress.vuejs.org/default-theme-config/#simple-css-override.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high High priority issue type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants