elm-css-webpack-loader
elm-css-webpack-loader copied to clipboard
Multiple entries support
Hello!
As I understand loader now supports only single entry with Stylesheets.elm
in the project root directory.
If I want to have at least two entries in my webpack.conf
I must specify two different Stylesheets.elm
files, but it's not possible at the moment.
So, do you have plans on supporting customising stylesheets filename and location?
A PR for this welcome.
Doesn't Stylesheets.elm work as an entrypoint though? As in, it lets you import all the Elm styles you want and bundles them up? I might be misunderstanding your use case though :)
@ahstro hmm, I've caught your point and it will work, but I think it'll result in slightly less effective page load. Say, I have two entry points admin
and app
for my two Elm modules Admin
and App
. If I use one Stylesheet.elm
importing styles from my modules and then require
it in index.js
I'll end up using admin
styles in app
– which I don't want to, because then large part of css becomes unused and could be cut off for faster page load. But nevertheless, thank you for your suggestion, I was looking for solution in this direction and your comment helped to find it out)
@tcoopman unfortunately a PR isn't enough – there is already a PR from @lukewestby for module option support, but there's also a problem with elm-css itself (only for nested modules which is my case).
As I a temporary workaround I forked elm-css and elm-css-webpack-loader, merged necessary commits and changed my package.json
.
#18 will allow a workaround: https://gist.github.com/OzTK/a17647d1e501b74e68a7d13d48f2cef8
Problem: You have to create one webpack rule per outputted css.