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] User style does not have highest priority #1110

Open
Mister-Hope opened this issue Sep 29, 2022 · 6 comments
Open

[Bug] User style does not have highest priority #1110

Mister-Hope opened this issue Sep 29, 2022 · 6 comments
Assignees
Labels
bug Something isn't working need review

Comments

@Mister-Hope
Copy link
Member

Mister-Hope commented Sep 29, 2022

cc @meteorlxy The problem seems to be the one I once reported through WeChat.

technically speaking, plugin style may be loaded after theme, but user custom style file is loaded at the end of theme style, so plugin style might get a higher priority.

This may be something we should treat as a bug.

Originally posted by @Mister-Hope in #1099 (reply in thread)

@Mister-Hope Mister-Hope added the bug Something isn't working label Sep 29, 2022
@Mister-Hope
Copy link
Member Author

Possible solution is extending core.

The core should accept a value related to user style, and it should inject it at last for bundler.

@Mister-Hope
Copy link
Member Author

Mister-Hope commented Oct 18, 2022

@meteorlxy Would like to have some discussion about how to fix this.

Techically, this is caused by https://github.com/vuepress/vuepress-next/blob/bcf6033ce2acf2b98dede4a4e580fe4f39222517/packages/core/src/app/createBaseApp.ts#L43-L46

My solution is adding a new filed in theme called userStyle, it can be a file path, package path or alias pointing to user file. (e.g.: for theme-default it will be '@vuepress/plugin-palette/style' as it's using palette plugin)

When we have a prepareUserStyle step at core, and style are imported at client/src/app.ts with import '@intermal/userStyle' after importing @internal/clientConfigs.

Besides, this also gives users ability to specific style (not palette or config) file they want to use.

@Mister-Hope
Copy link
Member Author

Mister-Hope commented Nov 21, 2022

Any suggestions with this one? If you agree I may open a pr.

@Mister-Hope
Copy link
Member Author

Some other point of views.

After re-thinking, I relealize that "user style" is actually not much related to theme and plugins.

Theme and plugins can provide it's own config files for users, and users just need a place to add addtional style after theme and plugins style.

Under this point of view, we shall remove the concept "user style" from theme. amd move it to core.

Maybe provide a new field called style in user config and it's default point to .vuepress/styles/index.css?

@Mister-Hope
Copy link
Member Author

Some other point of views.

After re-thinking, I relealize that "user style" is actually not much related to theme and plugins.

Theme and plugins can provide it's own config files for users, and users just need a place to add addtional style after theme and plugins style.

Under this point of view, we shall remove the concept "user style" from theme. amd move it to core.

Maybe provide a new field called style in user config and it's default point to .vuepress/styles/index.css?

@meteorlxy Could you share your points about this so that I can start doing something to fix this?

@Mister-Hope
Copy link
Member Author

Bump here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need review
Projects
None yet
Development

No branches or pull requests

2 participants