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

Bootstrap 4.6.2 issue with Numeric Class #1902

Open
jdinartejesus opened this issue Mar 3, 2023 · 4 comments
Open

Bootstrap 4.6.2 issue with Numeric Class #1902

jdinartejesus opened this issue Mar 3, 2023 · 4 comments

Comments

@jdinartejesus
Copy link

Hello everyone,

I've being trying to use Sass with Bootstrap 4.6.2, and it's impossible since I've always the error due to numeric class's. Eg: .100{ since I'm moving our project to use sass module instead of node-sass. I know the issue would be solved by escaping the values (sass/sass#2956, sass/sass#255), but would be needed to add this to the core library.

Modules Versions:

bootstrap-scss: v4.6.1
sass-loader: v8.0.2
sass: v1.58.3

Variables creating the issue:

_variables.scss
$grays: map-merge(
  (
    "100": $gray-100,
    "200": $gray-200,
    ...
  ),
  $grays
);

Error message:

SassError: Expected identifier.
6 │   .100{
@borisdamevin
Copy link

borisdamevin commented Mar 3, 2023

Hi @jdinartejesus

You need to prefix the class with \3. Example:

.\3100 {
}

The browser will see .100 { has normal class.

@jdinartejesus
Copy link
Author

@borisdamevin the issue is more the fact that comes directly from Bootstrap. I tried to overwrite variable but sadly doesn't work.

@nex3
Copy link
Contributor

nex3 commented Mar 4, 2023

I'm not sure what the request is here. What specifically would you like to see change about Sass's behavior?

@nex3 nex3 added the needs info label Mar 4, 2023
@voltaek
Copy link

voltaek commented Mar 14, 2023

@jdinartejesus Bootstrap v4 SCSS doesn't build any classes like the .100 you show in your error message, so I'm guessing you're using their $grays map of values to create classes from, which would mean the issue is in your code, not theirs.

Also, both of the issues you link to mention that CSS doesn't support dot-declared class names starting with numbers (without prefix hackery), so I'm not sure what you're looking for Sass to change. I would recommend you to just prefix your class with a valid character(s) so you are following CSS spec and can avoid fragile/hacky workarounds.

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

No branches or pull requests

4 participants