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

Order of application of Mint styles and CSS classes #723

Open
Namek opened this issue Dec 20, 2024 · 2 comments
Open

Order of application of Mint styles and CSS classes #723

Namek opened this issue Dec 20, 2024 · 2 comments

Comments

@Namek
Copy link
Contributor

Namek commented Dec 20, 2024

Hi! I use the Bulma css framework from which I use the the button class. I want to use that class on my element but also modify it a bit. However, I get into the problem of class application order.

To overwrite some property I have to use the !important modifier as shown below:

<button::btn-save class="button">"Save"</button>

style btn-save {
  height: 1rem !important
}

It is because the order of application would be like this:

  1. the custom btn-save class written in Mint code
  2. the button class from the Bulma framework

To avoid the !important modifier I can alternatively create the style in a CSS file instead of in mint code and use it in the specified order:

  1. Bulma's button class
  2. the custom btn-save class written in CSS file
<button class="button btn-save">"Save"</button>

This is not ideal because:

  1. the mint's file watcher doesn't refresh page when the CSS file gets edited
  2. the class in CSS becomes global (or I would have to manage multiple CSS files myself)
  3. the !important modifier breaks priorities of applying property values
  4. in some cases we have to write !important almost everywhere because

Solution?

I would propose a solution like this:

<button::.button::btn-save>"Save"</button>

style btn-save {
  height: 1rem
}

This way we could set specific order how classes are applied. The class names prefixed with the dot (like .button) would not be verified the same way as the usual Mint styles.

@gdotdesign
Copy link
Member

Thank you for the issue! I think the solution should be to apply Mint styles last, and it should be a relatively easy fix.

@Namek
Copy link
Contributor Author

Namek commented Jan 2, 2025

Thank you. For the case of using an external CSS code this sounds reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants