elm-css-webpack-loader icon indicating copy to clipboard operation
elm-css-webpack-loader copied to clipboard

Multiple entries support

Open pro100filipp opened this issue 7 years ago • 4 comments

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?

pro100filipp avatar Mar 24 '17 20:03 pro100filipp

A PR for this welcome.

tcoopman avatar Mar 26 '17 08:03 tcoopman

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 avatar Mar 28 '17 14:03 ahstro

@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.

pro100filipp avatar Mar 28 '17 15:03 pro100filipp

#18 will allow a workaround: https://gist.github.com/OzTK/a17647d1e501b74e68a7d13d48f2cef8

Problem: You have to create one webpack rule per outputted css.

OzTK avatar Jul 13 '17 15:07 OzTK