addyosmani / addyosmani/critical

Add the option of a prefix path

Aperta
#578 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
10.3k
Fork
390
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

in my vite project, the html compiles whit a default url, this url is generated depending on some environment variables in the project so is a dynamic url

`http://localhost:4000/assets/index-awd12431.css`

so this CSS file exists in my dist folder but critical can't find the file because it is unable to search for a path with localhost.

so it will be nice to have a prefixPath option, this way it is possible to ignore the prefix and only search for the files in the current path

```ts
generate({
base: './dist',
inline: true,
src: 'index.html',
extract: true,
prefixPath: 'http://localhost:4000'
});
```
this will omit the `http://localhost:4000` part of the import and get this result `/assets/index-awd12431.css`

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.