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

[Solution Included] CSS Parsed Incorrectly #168

Open
noalbalint opened this issue Oct 12, 2023 · 0 comments
Open

[Solution Included] CSS Parsed Incorrectly #168

noalbalint opened this issue Oct 12, 2023 · 0 comments

Comments

@noalbalint
Copy link

Hello @se-panfilov, thanks for creating this package.

I noticed that your makeCss function has a small bug that causes it to incorrectly parse the value of multi-word css rules.

For example, if I provide this message style override in the config object:

'.mini-toastr-notification__message': {
      display: 'inline-block',
      'vertical-align': 'middle',
      width: '240px',
      'white-space': 'pre-wrap',
    },

it will be parsed like so:
Screenshot 2023-10-12 at 14 02 12

the problem is this line:

.replace(/(\w*-?\w*): ([\w\d .#]*),?/g, '$1: $2;')

it needs to also look for - chars. ie, it should be changed to:

.replace(/(\w*-?\w*): ([\w\d .#-]*),?/g, '$1: $2;')

then the css is parsed as expected:
Screenshot 2023-10-12 at 14 04 19

Happy to open a PR for this but it looks like I don't have permission 🙏

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

No branches or pull requests

1 participant