addyosmani / addyosmani/critical

Add the option of a prefix path

未關閉
#578 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
10.3k
分支
390
PR 合併指標
30 天內沒有已合併 PR

描述

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`

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。