8000 fix: transform inline styles after other bundle hooks · nuxt/fonts@9156b8a · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 9156b8a

Browse files
committed
fix: transform inline styles after other bundle hooks
resolves #242
1 parent 500bf45 commit 9156b8a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/plugins/transform.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,19 @@ export const FontFamilyInjectionPlugin = (options: FontFamilyInjectionPluginOpti
179179
}
180180
}
181181
},
182-
async generateBundle(_outputOptions, bundle) {
183-
for (const key in bundle) {
184-
const chunk = bundle[key]!
185-
if (chunk?.type === 'asset' && isCSS(chunk.fileName)) {
186-
const s = await transformCSS(chunk.source.toString(), key, { relative: true })
187-
if (s.hasChanged()) {
188-
chunk.source = s.toString()
182+
generateBundle: {
183+
enforce: 'post',
184+
async handler(_outputOptions, bundle) {
185+
for (const key in bundle) {
186+
const chunk = bundle[key]!
187+
if (chunk?.type === 'asset' && isCSS(chunk.fileName)) {
188+
const s = await transformCSS(chunk.source.toString(), key, { relative: true })
189+
if (s.hasChanged()) {
190+
chunk.source = s.toString()
191+
}
189192
}
190193
}
191-
}
194+
},
192195
},
193196
},
194197
}

0 commit comments

Comments
 (0)
0