addyosmani / addyosmani/critical
Ability to pass custom headers with page remote CSS requests
- Lenguaje dominante
- JavaScript
- Estrellas
- 10.3k
- Forks
- 390
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
My use case involves requesting remote CSS assets from servers that require specific HTTP headers in place to allow requests to proceed.
I'd like to extend the [`requestAsync()`](https://github.com/addyosmani/critical/blob/master/lib/file-helper.js#L131) method to respect a configuration option (e.g. `assetHeaders`) to provide a map of custom HTTP headers when requesting assets.
e.g. usage
```
critical.generate({
inline: false,
base: '.',
folder: '.',
html: '...',
minify: true,
extract: true,
cssHeaders: {
'x-my-fancy-header': '... some custom header value...',
...
}
})
```
I'm open to suggestions on a more elegant way to address the issue as well as thoughts on naming. I'm happy to open a PR to this effect, but wanted to vet the idea here to gauge consensus first.
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.