vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.44k stars 4.78k forks source link

Custom index.styl styles are being overridden by the #1099

Open salomoneb opened 5 years ago

salomoneb commented 5 years ago

Bug report

Certain CSS defined in /docs/.vuepress/styles/index.styl is overridden by the default theme styling (defined in theme/styles/index.styl) with the latest version of vuepress.

Similar issues were noted in #472 and #571, with different responses; however, if the purpose of index.styl is to override default styles and the user needs to use !important to do so in some cases, then this should be clarified in the docs.

Version

^1.0.0-alpha.28

Steps to reproduce

  1. Create a new vuepress instance with the following structure:
    /vuepresstest
    |-- docs
    |-- .vuepress       
    |   |--styles
    |       |--index.styl
    |
    |-- articles
        |-- article 1
        |-- article 2
  2. In index.styl, modify the default h1 styling to:
    h1 {
    background: orange;
    font-size: 16px;
    }
  3. Run the dev build (yarn docs:dev)
  4. Navigate to the article 1 page and inspect the h1 heading. The background should be orange, but the font-size will be overridden by the theme styling: h1-sizing

What is expected?

The styles set in index.styl should override the default styling. In this case, the font-size should be 16px.

What is actually happening?

Styles in theme.styl are overriding index.styl.

Other relevant information

ulivz commented 5 years ago

Thanks for the report and I can repro that. but it only occurred in dev.

I need some time to do investigation for that.

Swader commented 5 years ago

Can confirm this still happens in dev but the production build has styles applied correctly.

ghost commented 4 years ago

Also seeing it here.

VuePress version: 1.0.2 Your OS: Mac OS 10.14.5 Node.js version: v12.6.0 Browser version: Chrome Version 75.0.3770.142 Is this a global or local install? local Which package manager did you use for the install? yarn

haoranpb commented 4 years ago

Same problem when trying to override .site-name in VuePress 1.2.0

But it also not works in production

capture

My Reproduction:

Hsueh-Jen commented 4 years ago

The only way is adding !important. I think it needs to be fixed.

bwyx commented 4 years ago

Same problem when trying to override .site-name in VuePress 1.2.0

But it also not works in production

capture

My Reproduction:

you should use .navbar site-name because of its nested css @ludanxer