embroider
embroider copied to clipboard
Did not emit the additional css entry point
We have an outputPaths
option in ember-cli-build.js
:
outputPaths: {
app: {
css: {
app: '/assets/bundle.css',
other: '/assets/other.css',
},
},
},
switch to embroider (with default options) did not emit the /assets/other.css
file, any suggestions?
I'm seeing the same issue when trying to make my sass compiler addon work with embroider.
The build hook gets called only once, with the 'standard' css file, but not the additional
After poking around a bit, I can see that the file does get built, but it looks like it doesn't get included in the index.html
This looks to be the place it's happening https://github.com//embroider-build/embroider/blob/2ac6e44630588ba8718d625f8cf9b77bc66931db/packages/core/src/app.ts#L430
It looks like it intentionally ignores outputPaths
for CSS, based off this comment.
Which is a bit odd, because that breaks expected behavior for from the Ember docs.
I'm hoping to find a way around it, because there are sometimes valid reasons to break up your final CSS bundle into multiple assets.
We could probably make this work as part of @embroider/compat
. But this whole area of CSS handling is essentially a legacy behavior.
Under embroider, you can declare exactly which parts of your app need which CSS files via imports, and then load it all lazily on demand via either await import()
or Embroider's splitAtRoutes
.
The rule is, if you say import "./some.css"
with an explicit .css
extension, embroider guarantees that that css file will be loaded into the DOM before the importing javascript module evaluates.