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

Provide a SourceMapping ResourceHandler #430

Closed
VsevolodGolovanov opened this Issue Jan 27, 2018 · 7 comments

Comments

Projects
None yet
2 participants
@VsevolodGolovanov

VsevolodGolovanov commented Jan 27, 2018

CSS, JS have source maps now. Mapping is commonly done via a special comment at the end of a file:

/*# sourceMappingURL=sourcemaps/argus.css.map */

, but it's kinda hard to make it work with JSF due to mapping.

Thankfully, there is an alternative: the SourceMap header. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/SourceMap
OmniFaces could provide a ResourceHandler that fills this header with a proper JSF resource link. Maybe support some options like: source maps near their respective derivative files, or source maps in a separate directory. It should only fill the header, if a source map actually exists.

@BalusC

This comment has been minimized.

Member

BalusC commented Jan 28, 2018

but it's kinda hard to make it work with JSF due to mapping.

You can use #{resource['sourcemaps/argus.css.map']} to print the correct URL.

OmniFaces could provide a ResourceHandler that fills this header with a proper JSF resource link. Maybe support some options like: source maps near their respective derivative files, or source maps in a separate directory.

Reasonable.

@VsevolodGolovanov

This comment has been minimized.

VsevolodGolovanov commented Jan 28, 2018

My CSS are generated (by libsass-maven-plugin), I can't edit them.

@BalusC

This comment has been minimized.

Member

BalusC commented Feb 3, 2018

I did a local experiment. It appears that the response header is ignored when # sourceMappingURL comment is present. I can't configure my Samaxes minifier to generate the source map without adding that comment. So far now I think using UnmappedResourceHandler is your best bet. Or, the minifier must be configurable to not add the # sourceMappingURL comment to the JS/CSS file. I only can't seem to find an option in Samaxes minifier.

@VsevolodGolovanov

This comment has been minimized.

VsevolodGolovanov commented Feb 3, 2018

libsass-maven-plugin provides the omitSourceMapingURL option to disable adding the # sourceMappingURL comment.

@BalusC

This comment has been minimized.

Member

BalusC commented Feb 3, 2018

BalusC added a commit that referenced this issue Feb 3, 2018

@BalusC

This comment has been minimized.

Member

BalusC commented Feb 3, 2018

It's in 3.1-SNAPSHOT. Let me know if it does the job for you.

@VsevolodGolovanov

This comment has been minimized.

VsevolodGolovanov commented Feb 5, 2018

It'll probably take me a while, so I'm closing the issue. I'll report if there any problems. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment