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

Expose sourcemaps to transform #51

Closed
wants to merge 1 commit into from

Conversation

GravlLift
Copy link
Contributor

@GravlLift GravlLift commented Dec 20, 2021

I originally raised a request for relative url rewriting in issue #19, and it looks like several other people have had similar requests since then. The issue was originally closed due to being outside the scope of this project.

That is perfectly understandable, however, as it turns out there is very little that needs to be done in order to allow someone else to implement a result-url-loader-plugin-esque solution on their own. Specifically, the only thing that needs to exist is that the sourcemap generated by sass needs to be exposed to the transform method of this plugin.

So that's what this PR does: it simply exposes the source maps if any are generated (setting the sourceMap property to sourceMap: 'out.map' will generate them, for example) as an optional parameter of the transform method. It's fully backward compatible with any current uses of this plugin.

And if anyone comes asking for relative url writing, you can tell them all of the pieces necessary to do so are now available (which I'm planning on doing. If it works, I'll release a plugin for your plugin).

@glromeo
Copy link
Owner

glromeo commented Dec 20, 2021

Hi Jason, I am sorry I had to cut short your feature request back then, time wasn't right.

Things have changed though and I hope you will be happy to know that there is a new SASS API now and that the plugin will use that and as a consequence can safely rewrite urls.
Please have a look at #48 and the v2.x branch

I plan on introducing sourcemaps soon but they are not necessary for url rewriting.

If you still want to contribute enabling source maps please do it against v2.x. but bear in mind there are several caveats:

  1. how should sourcemaps be stored?
    depending on the transformation type they could be written externally or should necessarily be embedded
  2. sourcemaps need to be translated when precompile is used (see global variables issue)
  3. they have to be optional

@GravlLift
Copy link
Contributor Author

@glromeo, what excellent timing! This looks much better than the solution I was going to hack into existence with source maps, thank you very much.

@GravlLift GravlLift closed this Dec 20, 2021
@GravlLift GravlLift deleted the source-map-expose branch December 20, 2021 23:31
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 this pull request may close these issues.

2 participants