Skip to content

Can support specify the position when insert CSS asynchronously? #504

Closed
@kingller

Description

@kingller
  • Operating System:
  • Node Version: 12.13.1
  • NPM Version: 6.12.1
  • webpack Version: 4.41.2
  • mini-css-extract-plugin Version: 0.8.0

Feature Proposal

When insert CSS asynchronously, insert it before a style link, because the position of the css file will affect its weight.

mainTemplate.hooks.requireEnsure.tap(
   ...
   'var head = document.getElementsByTagName("head")[0];',
   'head.appendChild(linkTag);',
   ...
)

Can I pass in a string to replace the words bellow?

'head.appendChild(linkTag);'

Feature Use Case

I extracted a theme color file to switch theme colors. Then I want to insert CSS asynchronously before it (when dynamic import used) to keep the styles of theme color file override the inserted file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions