-
Notifications
You must be signed in to change notification settings - Fork 323
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
Having a non-breaking space in css leads to error #1006
Having a non-breaking space in css leads to error #1006
Comments
+1 |
Please fix this! Angular CLI cant build because of this! |
+1 |
1 similar comment
+1 |
+1 this is so funny in a sad way. |
Any new when it will be fixed? |
@jakubpawlowicz are any contributors able to help with this issue? |
any update on this? |
if it helps just scan all of your files for non breaking space using Notepad++ or regex in IntelliJ / VS whichever tool you use to spot malformed locations.
|
I gave a code snippet on the main issue post. By patching clean-css with it everything works properly. The fact is I don't know how to write test on clean-css context, so I can't open a PR. |
@barocsi @blackholegalaxy for me the error came from a third party lib (materialize-css) i'm using in my project. I can't update those css or scss file. |
Sure, will fix it in 4.1.10 coming out (hopefully) today. |
Hmmm, I took a look at the source code and we read all files as utf-8 not utf-16, so it will be rather tricky to fix at this point. Could you at least provide me with a test CSS file to test on? |
@jakubpawlowicz the issue appears with materializecss (tested with v0.100.2) cf https://github.com/Dogfalo/materialize/blob/master/dist/css/materialize.min.css btw, as mention by @scote, as this issue is raised by a third party lib, this is really annoying ! I hope you could find a solution quickly... Thank you very much to address this issue ! |
Thanks @enavarro222 for a quick reply. I've fetched the file but can't replicate the issue yet - since the it shows up when reading input source maps, can someone please post materialize.css transpiled from SCSS with source map? |
@jakubpawlowicz not sure is it could help but here is a minimal setup to reproduce the issue with angular cli :
Then you have to add
And then:
|
|
@enavarro222 thx for repro. You could also simply add any no breaking space anywhere in any css. It will break. Here is the character: " " (reference: http://www.fileformat.info/info/unicode/char/00a0/browsertest.htm) This character exists in UTF-8 @jakubpawlowicz The error occurs when any of the three kind of no-break space is present:
|
I've been able to reproduce the issue locally, however it's not entirely clean-css bug but also sass building incorrect source map. I found couple cases when line:column data inside it is invalid (e.g. column being negative causing However I'll add some code to handle such cases gracefully. |
Great! Thanks @jakubpawlowicz |
It's fixed in 4.1.10. |
@blackholegalaxy will you reopen your issue on angular/cli? |
Great work @jakubpawlowicz! Thanks! |
@cote since it will be fixed by version 4.1.10 here angular CLI issue should solve by itself since they have a dependency set to Since the 4.1.10 is out, we can test with no-break space in css code and reinstall angular CLI to check if the builds now succeeds. If it doesn't, let me know, i'll may reopen issue. |
Just a quick real project test with invalid char on scss source. Removed node_modules and let npm install latest clean-css. Tested under 1.6.8, 1.7.0, 1.7.1, 1.7.2: So the fix works. Thanks @jakubpawlowicz |
Boom, cheers! 🍺 |
thanks a lot @jakubpawlowicz ! |
Environment
Using clean-css through Angular CLI 1.7.0 which moved to clean-css. clean-css is imported through webpack plugin as it can seen here: https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/plugins/cleancss-webpack-plugin.ts
Configuration options
Input SCSS
Image, since non-breaking space would not show up properly (screenshot taken on VSCode on faulty scss code, with Highlight bad characters VSCode plugin):
This code was transpiled to CSS, which still contains the non-breaking space. Resulting in following error.
Error
Expected behavior
Presence of non-breaking space should not block the production of css since these kind of spaces should be deleted in the minification process.
Potential fix
We could add a marker for no-break space and replace the character with standard space.
then in tokenize:
Can't open a PR as I don't know how to test that in your test suit.
The text was updated successfully, but these errors were encountered: