How to use Vue with TypeScript and other preprocessor? #662
Replies: 3 comments
-
Happy to help, can you share an example of steps that I could follow to reproduce? (feel free to copy over from the old repo, if they were already there). Also, you can try following the postcss guide here: https://www.snowpack.dev/#postcss |
Beta Was this translation helpful? Give feedback.
-
This behavior is a little difficult now, because the way Snowpack works it can be tough to detect CSS in a Say we made a new PostCSS plugin, which would result in the following build order:
Does that work with Vue’s scoped styles? Does Vue need to run PostCSS itself, or is PostCSS always run afterward? If the latter, I think we can support that easily. But if the former, we may need to add something special to our Snowpack Vue plugin. |
Beta Was this translation helpful? Give feedback.
-
I'm interested in this! I would love to be able to use PostCSS in Vue's single-file-components. As a test, I wrote some nested CSS into a component's <style scoped>
.parent {
.child {
background-color: red;
}
}
</style> Vue will output as inline CSS: .parent[data-v-scopedid] {
.child {
background-color: red;
}
} In other words, it scopes the parent element (which is fine) and also passes through the nested CSS as-is (no errors, no modifications) Looking at that I think we can safely run PostCSS on that output. |
Beta Was this translation helpful? Give feedback.
-
I tried to use Vue with official template. But TypeScript doesn't compile neither the PostCSS. I already open the issue on create-snowpack-app but the repo is archived. I am not sure if I can use other plugin or script to overwrite official template.
For PostCSS
Step to reproduce.
yarn tailwindcss init
to create empty configuration file.."build:css": "postcss"
to the snowpack config scripts.6.Modify App.js style tag with following content
For TypeScript
Edit 1: Add steps to reproduce as @fcamblor requested and correct some sentences.
Beta Was this translation helpful? Give feedback.
All reactions