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

5.0.1 warnings #57

Closed
XhmikosR opened this issue Feb 11, 2021 · 10 comments
Closed

5.0.1 warnings #57

XhmikosR opened this issue Feb 11, 2021 · 10 comments

Comments

@XhmikosR
Copy link
Contributor

XhmikosR commented Feb 11, 2021

Hey, @jakubpawlowicz. I haven't had a chance to test #51 yet, but decided to give 5.0.1 a go with our current main branch. I keep getting this on Windows:

C:\Users\xmr\Desktop\bootstrap>npm run css-minify

> bootstrap@5.0.0-beta2 css-minify C:\Users\xmr\Desktop\bootstrap
> npm-run-all --parallel css-minify-*


> bootstrap@5.0.0-beta2 css-minify-rtl C:\Users\xmr\Desktop\bootstrap
> cleancss -O1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap.rtl.min.css dist/css/bootstrap.rtl.css && cleancss -O1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-grid.rtl.min.css dist/css/bootstrap-grid.rtl.css && cleancss -O1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-utilities.rtl.min.css dist/css/bootstrap-utilities.rtl.css && cleancss -O1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-reboot.rtl.min.css dist/css/bootstrap-reboot.rtl.css


> bootstrap@5.0.0-beta2 css-minify-main C:\Users\xmr\Desktop\bootstrap
> cleancss -O1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap.min.css dist/css/bootstrap.css && cleancss -O1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-grid.min.css dist/css/bootstrap-grid.css && cleancss -O1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-utilities.min.css dist/css/bootstrap-utilities.css && cleancss -O1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-reboot.min.css dist/css/bootstrap-reboot.css

WARNING: Ignoring local source map at "C:\Users\xmr\Desktop\bootstrap\bootstrap.css.map" as resource is missing.
WARNING: Ignoring local source map at "C:\Users\xmr\Desktop\bootstrap\bootstrap.rtl.css.map" as resource is missing.
WARNING: Ignoring local source map at "C:\Users\xmr\Desktop\bootstrap\bootstrap-grid.css.map" as resource is missing.
WARNING: Ignoring local source map at "C:\Users\xmr\Desktop\bootstrap\bootstrap-grid.rtl.css.map" as resource is missing.
WARNING: Ignoring local source map at "C:\Users\xmr\Desktop\bootstrap\bootstrap-utilities.css.map" as resource is missing.
WARNING: Ignoring local source map at "C:\Users\xmr\Desktop\bootstrap\bootstrap-utilities.rtl.css.map" as resource is missing.
WARNING: Ignoring local source map at "C:\Users\xmr\Desktop\bootstrap\bootstrap-reboot.css.map" as resource is missing.
WARNING: Ignoring local source map at "C:\Users\xmr\Desktop\bootstrap\bootstrap-reboot.rtl.css.map" as resource is missing.

It seems something is wrong with paths on Windows because the referenced map filepaths are wrong. dist/css is missing.

@XhmikosR
Copy link
Contributor Author

This could be coming from clean-css itself and not clean-css-cli.

@XhmikosR
Copy link
Contributor Author

@jakubpawlowicz yeah, this belongs to clean-css, please move it to that repo :)

After further digging into it, the warning comes from https://github.com/jakubpawlowicz/clean-css/blob/62976556f6f92331e2e047e633821760d713fe01/lib/reader/apply-source-maps.js#L164-L178

It seems that in v5, the current working dir isn't taken into account or something like that.

@XhmikosR
Copy link
Contributor Author

...and it seems that if I pass --with-rebase then the warnings are gone.

So, perhaps this is by design after all. That being said, there's still an issue with Windows separators being used in sourcemaps on Windows. I'd swear there was an issue about it, but maybe it's in clean-css.

@XhmikosR
Copy link
Contributor Author

So, @jakubpawlowicz is it normal that --with-rebase is needed now? If so, the issue can be closed, it's just that I'm not 100% sure it's normal myself.

We build our sass and then use clean-css-cli to minify the CSS. The problem seems to happen when clean-css tries to load the existent sourcemaps.

@jakubpawlowicz
Copy link
Collaborator

@XhmikosR yup, since 5.0 --with-rebase is needed - see https://github.com/jakubpawlowicz/clean-css-cli#whats-new-in-version-50

I have just pushed two fixes to source maps and rebasing in main branch, maybe that's something that will make it work for you.

@jakubpawlowicz
Copy link
Collaborator

And the separator issue is clean-css/clean-css#964

@XhmikosR
Copy link
Contributor Author

XhmikosR commented Apr 9, 2021

@jakubpawlowicz I think cli is also affected by the separator issue separately since it's using its own logic for sourcemaps apart from clean-css.

EDIT: or at least for the line endings issue that is 100% true.

@Exotelis
Copy link

Exotelis commented Mar 4, 2022

I guess the reason is the /*# sourceMappingURL=<file> */ of the source file. If I'm not mistaken in clean-cli the first parameter of the minify function only accepts pure text. In clean-css-cli it is possible to use a filepath, the content will be parsed and used as the first parameter of the minify function. However, this means when the input file is in a different dir than the cwd the sourceMappingURL of the source file cannot be found then.

$ cssclean css/input.css --source-map 

Warn: Ignoring local source map at "input.css.map" as resource is missing.

The file cannot be found, because it is not searching in the dir of the input.css. A possible solution would be to cd in dirname(inputfile) before the minify function. After that we can cd back in the old dir.

Other solution would be that --source-map accept a file e.g. --source-map css/input.css.map

@Exotelis
Copy link

Exotelis commented Mar 5, 2022

And in addition, when the maybeSourceMap parameter was set, clean-css should completely ignore the source map annotation in the source file. But that is a clean-css issue I guess ;)

@jakubpawlowicz
Copy link
Collaborator

Closing as 'won't fix' as clean-css-cli is going into maintenance mode. If anyone wants to bring it back up, please submit a PR.

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

3 participants