jrit / web-resource-inliner

Inlines img, script and link tags into the same file
MIT License
69 stars 30 forks source link

recursive inline of css url - woff format binary font #73

Open milahu opened 3 years ago

milahu commented 3 years ago

input - index.html

<link rel="stylesheet" href="/css/noto-sans/latin.css">

input - css/noto-sans/latin.css

/* noto-sans-latin-400-normal*/
@font-face {
  font-family: 'Noto Sans';
  src:
    local('Noto Sans'),
    local('NotoSans'),
    url('./files/noto-sans-latin-400-normal.woff2') format('woff2'),
    url('./files/noto-sans-latin-400-normal.woff') format('woff');
}

actual result

<style>
/* noto-sans-latin-400-normal*/
@font-face {
  font-family: 'Noto Sans';
  src:
    local('Noto Sans'),
    local('NotoSans'),
    url("css/noto-sans/files/noto-sans-latin-400-normal.woff2") format('woff2'),
    url("css/noto-sans/files/noto-sans-latin-400-normal.woff") format('woff');
}
</style>

expected result (as produced by the good-old inliner)

<style> @font-face{ font-family:'Noto Sans';font-style:normal;font-display:swap;font-weight:400;src:local('Noto Sans'), local('NotoSans'), url('data:application/font-woff2;base64,d09GMgABAAAAAD64ABEAAAAAd5AAAD5YAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGmobjkQcMgZgAIMSCIF+CY80ERAKgbQIgZoaC4NWAAE2AiQDhygEIAWDGAcgDIQaG6FnNWybNp27VUUrNARqJMJGClJwFMHGAQSFLUv+/48JMsbth9tXAUelosS0xmgLlpETplnhYA8FURBlp46.....

the file css/noto-sans/files/noto-sans-latin-400-normal.woff2 does exist ; ) its from the npm package @fontsource/noto-sans

inliner found the file too, maybe that file type is not yet supported here?

jrit commented 3 years ago

yeah there is no "recursive" mode available. I would be happy to take a PR to enable that in some way