Closed brophdawg11 closed 4 years ago
Yep, we can implement this :+1: so it is feature
@brophdawg11 would the style need to be injected in the right order as well? so async.css
go under app.css
A functionality like the insertAt
of style-loader would make more sense, since you can specify the position even more exact.
I have the use-case that I have a large header (different device- and SEO-specific meta tags which are less important than the CSS references). So I want to inject the CSS-Links directly after the title-tag.
Using
insertAt: {
after: 'title'
}
that would be easily possible.
To achive the usecase of @brophdawg11, what about:
insertAt: {
appendTo: '.style-container'
}
?
I think appendTo
, before
and after
, would cover all use-cases.
Hey, thank you for the awesome plugin! really waiting for this feature, when are you planning to release it?
Sorry for the delay - I just updated the PR (https://github.com/webpack-contrib/mini-css-extract-plugin/pull/371) with the new approach suggested by @evilebottnawi
Is there a chance to get an option, to insert the <link>
tags right after the <title>
tag? Or should I create a separate issue for that?
Would this package be open to adding support for an
insertInto
option similar to whatstyle-loader
supports, which allows clients to specify a selector for the DOM node into which they wantlink
tags inserted inside of? By default, it would be thehead
.We have a scenario where some orchestrated content being injected into an existing app inside of
<body>
and that content contains it's mainapp.css
file. However, any async-loaded CSS files break the expected cascade because they go into<head>
. So basically, we end up with a DOM such as:When the normal order should be
app.css
->async.css
.I'm planning to get a PR together, but the solution is fairly straightforward it seems. I've modified
mainTemplate.hooks.requireEnsure.tap
locally to essentially generate JS code that does the following, and it seems to work without issue: