Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transformCSS: 'post' #50

Closed
schelmo opened this issue Feb 24, 2021 · 0 comments
Closed

transformCSS: 'post' #50

schelmo opened this issue Feb 24, 2021 · 0 comments

Comments

@schelmo
Copy link
Contributor

schelmo commented Feb 24, 2021

Hello,
when using transformCSS: 'post',
the css has already been converted to Javascript

import { updateStyle, removeStyle } from "/dist/@vite/client"
...

and windicss cant parse it anymore.
maybe put the the enforce option only if transformCSS is 'pre' ?
as a workaround you can use
transformCSS: 'some-other-string 😜'
when using 'pre' (or true), postcss hasnt run and windicss cant parse when you use e.g. postcsss-nesting

or is the first push with enforce: 'pre' wrong?

if (options.transformCSS === true) {
plugins.push({
name: `${NAME}:css:pre`,
enforce: 'pre',
transform(code, id) {
if (!id.match(/\.(?:postcss|scss|css)(?:$|\?)/i) || utils.isExcluded(id) || id === MODULE_ID_VIRTUAL)
return
debug.css('pre', id)
return utils.transformCSS(code)
},
})
plugins.push({
name: `${NAME}:css:post`,
transform(code, id) {
if (!id.match(/\.(?:sass|stylus|less)(?:$|\?)/i) || utils.isExcluded(id) || id === MODULE_ID_VIRTUAL)
return
debug.css('post', id)
return utils.transformCSS(code)
},
})
}

@antfu antfu closed this as completed in af26e84 Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant