thgh / rollup-plugin-scss

Rollup and compile multiple .scss, .sass and .css imports
MIT License
134 stars 47 forks source link

Injecting css path through the bundle #29

Closed mfrachet closed 5 years ago

mfrachet commented 5 years ago

Is this possible to automatically import the css sheet while importing the js module?

Actually, I'm finally having to output:

And I wanted to add the css file to the dom through the js one.

Is this something feasible in the current lib state?

Thanks for the job by the way 💪

thgh commented 5 years ago

Yes, looks feasible. Would you embed the content of a style tag and then add the style tag dynamically? Or create a link tag that loads the css file? The latter might require an extra basePath parameter.

PR welcome!

mfrachet commented 5 years ago

My use case concerns the link addition 😊

thgh commented 5 years ago

Here is a start https://github.com/thgh/rollup-plugin-scss/commit/4a0645065d878285a8d3cb9ba8597384fa193cd5 (I did not test)