numical / script-ext-html-webpack-plugin

Enhances html-webpack-plugin functionality with different deployment options for your scripts including 'async', 'preload', 'prefetch', 'defer', 'module', custom attributes, and inlining.
MIT License
588 stars 105 forks source link

Proposal: Allow setting custom attributes on stylesheet/CSS link tags #72

Closed alex-ketch closed 4 years ago

alex-ketch commented 4 years ago

Hi there, and thanks for this plugin, it's come in very handy for setting custom attributes on injected chunks.

A use case I've come across is needing to set attributes on stylesheet links, however due to this line of code checking whether the link tag has a as="script" attribute, stylesheet link tags (<link rel="stylesheet" …) are skipped.

Right now I've solved our problem in a fork with a rudimentary change, but I was wondering if this was something that was in scope for this plugin, and if a PR for this functionality would be wanted.

Also, if there's a better plugin for achieving this please let me know.

onurozkan commented 4 years ago

@numical

"test" attribute gives us a power to select whatever file we want, so basically current implementation supports mimetypes other than script. Only thing we need to do, dynamically fill "as" attribute.

Here is very basic implementation, not perfect, but could help lots of people with very little effort.

https://github.com/onurozkan/script-ext-html-webpack-plugin/commit/0265a5cae3ac6502e4cd27ecbfd004a384f70afa

numical commented 4 years ago

Hello - I'm sorry to say that this plugin is no longer being maintained. I have tried to close all issues ahead of doing this but instead have found that the issue list just keeps growing. I simply do not have the time to keep up. Sorry. Please keep an eye on the README where I will record anyone who forks this repo with the intention to supporting it in the future.