Skip to content

Inconsistent css ordering between dev and build #1885

Open
@favoyang

Description

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

Bug report

This issue is similar to #643, when overriding default theme, the css order is inconsistent between dev and build. However #643 is solved and closed. So this may be a new issue.

Steps to reproduce

https://github.com/favoyang/netlify-vuepress-test

I've made a minimal reproduced repo

  • Create a local theme, which extends from default theme.
  • Create a styles/index.styl, which styles paragraph to red.
  • Create a styles/custom.scss, which styes paragraph to blue.
  • Create a layouts/Layout.vue, which overrides @parent-theme/layouts/Layout.vue, and loads styles/custom.scss in a style tag.
  • Create a home page with a few paragraphs for testing.

That's it. Let's try compare yarn docs:dev with yarn docs:build

What is expected?

I would expect in such setup the css order as below (higher overrides lower)

↑ custom.scss (load from layouts/Layout.vue's style tag)
↑ @theme/styles/index.styl
↑ @parent-theme/styles/index.styl

Then in either dev or build, the paragraph will be blue.

What is actually happening?

In dev, the paragraph is blue.

image

In build, the paragraph is red. (you can also check on https://netlify-vuepress-test.netlify.com/)

image

It actually doesn't matter which order is correct, but it should be consistent.

Other relevant information

  • Then reason to load custom.scss is that I intended to load a 3rd-party css framework in scss format, and use it to override default theme styling.
  • Output of npx vuepress info in my VuePress project:
$ npx vuepress info

Environment Info:

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz
  Binaries:
    Node: 10.16.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.10.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.329.0
  npmPackages:
    @vuepress/core:  1.1.0
    @vuepress/theme-default:  1.1.0
    vuepress: ^1.1.0 => 1.1.0
  npmGlobalPackages:
    vuepress: Not Found

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