-
Notifications
You must be signed in to change notification settings - Fork 11
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
Breaks with kebab-case variable names #1
Comments
Sorry for the delay on this and thanks for reporting. My approach on solving this is that any non valid javascript identifiers will be skipped unless an option is set determining how to resolve the error. The option would receive either snake_case, camelCase or PascalCase. So that the variable $color-black would be exported as color_black if for example snake_case is set. Does this work for your use case?
|
I solved this in my fork by just converting everything to camelCase for the exports, and converting the keys to camelCase as well unless the I think for most users it's fine to convert the export names to camelCase to ensure builds work consistently, but yeah of course adding the normalisation strategy as an option is a nice addition. |
@Eiskis that is the approach I'm taking but there are some differences.
Currently writing tests |
@Eiskis @monvillalon thank both of you. I used Eiskis folk for our internal project, but sass vars in js idea was postponed for a time being. But I will be using it for my personal project. Eiskis approach was suffice, but adding more option seems a good idea. |
@monvillalon nice to see you're picking up the development again! |
@Eiskis I am using your fork of this project but cannot get it working. I have updated the Webpack
And get the following error (looks like an
My Sass map is as follows:
Do you have any idea what I am doing wrong here? |
@jjenzz First thing that comes to mind: does it work if you add a trailing comma in Sometimes I really don't like Sass. |
@Eiskis can you either abandon your fork in preference of this project, or enable issue reporting on your fork? I tried our your branch which is more frequently updated, but I can't report bugs so I don't think it's a good choice for us moving forward. (Sorry @monvillalon 😉) |
@rhys-vdw issues enabled! |
Love the project, I'm desperately looking for a reliable implementation of this functionality for webpack. Ran into an issue as soon as I tried it though, namely it seems that the project doesn't escape or transform any of the variable names and breaks if kebab-case is used (which is quite common with CSS):
constants.scss:
Webpack error:
Other plugins I've used transform the keys to camelCase (with an option to disabled this). Adding an option to decide what the casing is should be relatively easy, and
lodash
has good support for different transformations.Didn't have time to try to fix it or file a PR yet, but decided to still file this issue.
The text was updated successfully, but these errors were encountered: