Closed ChristianHuff-DEV closed 4 years ago
Can you share your webpack config? It sounds like you don't have the postcss loader properly configured.
@thalesagapito it is a new project created with @vue/cli version 4.2.2.
I didn't tinker with any of the default configurations.
Well that's probably what's wrong. According to the Vue CLI docs:
Vue CLI uses PostCSS internally
So since you have used it to create your project it'll work out of the box, and that's why your css by default has postcss processing. But since you're trying to add lang="postcss"
, your webpack config needs instructions on how to process these lang="postcss"
blocks.
What you need to do is update your vue.config.js like this:
module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\.postcss$/,
use: [ 'style-loader', 'postcss-loader' ]
}
]
}
}
}
And add the postcss-loader
package to your devDependencies.
Thank you for your help!
I thought that since the Vue CLI docs already use PostCSS I don't have to do any additional setup.
I have the following Vue component:
The style is applied and all is good. But I would like to use
<style lang="postcss">
to get syntax highlighting. But when addinglang="postcss"
I get the following error:Going by this Twitter post. This should be possible. Is there any additional setup or configuration required to get syntax highlighting when using the directives in a Vue component?
It is a new project created with vue-cli version 4.2.2.
I added a
postcss.config.js
in the src folder containing the following:My
tailwind.config.js
is empty:The following packages are installed: