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

If css containes a style without semicolon, building fails #4

Open
constgen opened this issue May 16, 2019 · 3 comments · May be fixed by #6
Open

If css containes a style without semicolon, building fails #4

constgen opened this issue May 16, 2019 · 3 comments · May be fixed by #6

Comments

@constgen
Copy link
Contributor

Try to put background image as a last style in a rule but without a semicolon delimiter. This is valid CSS. The last semicolon is optional in the last line of the CSS rule. But this brakes building with react-scoped-styles. The issue doesn't apear if semicolon is always present. Can't be reproduced if the last line doesn't contain url(...) function.

image

image

Seems like an issue with regular expression.

@nairinarinyan
Copy link
Owner

Is there a specific reason not to put a semicolon in the end of the declaration? Or it's just a matter of preference?

Testing for presence of semicolon to figure out if it's a selector or declaration is the easiest. Because we assume that if you use preprocessor it will output a valid css with semicolons. E.g in some build configs resulting css selectors are split into multiple lines which means we can't test for {. And if you have
opacity: .5, you can't easily know if it's declaration or selector. So I think keeping it simple and generic enough is the way to go.

@constgen
Copy link
Contributor Author

constgen commented Jun 4, 2019

It should be possible to not put semicolon as it is valid CSS. Specs says that is is not a "line end"
but "delimiter" between properties.

I think the origin of this issue produces also the bug below.

Source

image

Result

image

padding is broken, but line-height is not. I experimented with these properties but padding always stay broken. Don't know why.

@constgen constgen changed the title Id css containes a style without semicolon, building fails If css containes a style without semicolon, building fails Jul 21, 2019
@constgen constgen linked a pull request Jul 21, 2019 that will close this issue
@Flcwl
Copy link

Flcwl commented Dec 24, 2019

how deal with it?

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

Successfully merging a pull request may close this issue.

3 participants