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

You can't get the real source paths when using sourceMapEmbed #45

Closed
homer0 opened this issue Apr 16, 2018 · 3 comments
Closed

You can't get the real source paths when using sourceMapEmbed #45

homer0 opened this issue Apr 16, 2018 · 3 comments

Comments

@homer0
Copy link
Contributor

homer0 commented Apr 16, 2018

Hi,

I was trying to build a plugin that would extract images and web fonts from the generated CSS and copy them to the distribution directory.

The idea was to use sourceMapEmbed, then after this plugin generated the CSS, I would go get the map, list the original sources and search for url(...)s on the code, copy them and replace the path on the CSS.

The problem I found is that, because this plugin uses renderSync with the data option, the source map sources is stdin.

Playing around with the plugin code I saw that the only reason for using data is when you receive the prependSass option, and I was thinking that maybe you could use data only when prependSass has some value, and in case is empty, use file.

The change would be something like this:

- const sassConfig = Object.assign({ data: `${prependSass}${code}` }, options.options);
+ const baseConfig = prependSass
+   ? { data: `${prependSass}${code}` }
+   : { file: id };
+ const sassConfig = Object.assign(baseConfig, options.options);

The rest would work the same.

Would you consider it if I send a PR?
Regards

@differui
Copy link
Collaborator

differui commented Apr 17, 2018

Hi @homer0, I think it could be nice.Feel free to send the PR.I will handle it in time.

@differui
Copy link
Collaborator

hi @homer0 checkout the new version:

rollup-plugin-sass@0.6.1

@homer0
Copy link
Contributor Author

homer0 commented Apr 18, 2018

@differui Awesome, thanks!!!

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

2 participants