Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Allow configuring html-loader via web preset options #682

Closed
edmorley opened this issue Jan 23, 2018 · 3 comments
Closed

Allow configuring html-loader via web preset options #682

edmorley opened this issue Jan 23, 2018 · 3 comments
Labels

Comments

@edmorley
Copy link
Member

edmorley commented Jan 23, 2018

The font, image, style and babel loaders support being passed options via the web preset to configure their behaviour:
https://github.com/mozilla-neutrino/neutrino-dev/blob/v8.0.18/packages/web/index.js#L132-L134

However the html-loader doesn't:
https://github.com/mozilla-neutrino/neutrino-dev/blob/v8.0.18/packages/web/index.js#L104

For context, the option I wish to adjust is html-loader's attr option, which defaults to ['img:src'], but I'd like to change to ['img:src', 'link:href'] so it picks up favicons (<link href="...">).

If we did add such an option, we'd probably have to call it htmlLoader or similar, since html is already taken for the options passed to html-webpack-plugin.

My workaround in the meantime:

neutrino.config.module
  .rule('html')
  .use('html')
  .tap(options => ({
    ...options,
    // Override html-loader's default of `img:src`,
    // so it also parses favicon images (`<link href="...">`).
    // TODO: Remove once we update to html-loader 1.0.0+:
    // https://github.com/webpack-contrib/html-loader/issues/17
    attrs: ['img:src', 'link:href'],
  }));
@edmorley
Copy link
Member Author

edmorley commented May 9, 2018

If we did add such an option, we'd probably have to call it htmlLoader or similar, since html is already taken for the options passed to html-webpack-plugin.

@mozilla-neutrino/core-contributors thoughts whether we should do this / naming?

@edmorley
Copy link
Member Author

edmorley commented Jun 7, 2018

Now that the default value for attrs has been updated in #943, Treeherder's has no need to be able to pass custom options to html-loader when used via the react preset.

As such, I'm happy to close this out, unless we feel it's a feature we really should have regardless?

@eliperelman
Copy link
Member

We can close, I don't think it's too crazy to ask for an options tap here.

@edmorley edmorley closed this as completed Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants