-
Describe the problem:EDIT: The output is a library, not an app (entrypoint is not the same) The classes I added in the HTML are not conserved when building and purging style. There is no CSS output <template>
<div class="text-3xl text-red-100">
<h1>Hello</h1>
</div>
</template> module.exports = {
purge: {
content: [
'./src/**/*.vue',
'./src/**/*.html',
'./src/**/*.js',
],
},
}; Link to a minimal reproduction:
|
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 2 replies
-
Are you sure postcss runs? I've checked the build script in package.json and the only thing it does is execute |
Beta Was this translation helpful? Give feedback.
-
Isn't PostCSS part of the build process ? If I change the purge config or put wrong configuration I have warnings during the biuld process so I guess the purge step is executed. |
Beta Was this translation helpful? Give feedback.
-
I am not really familiar with |
Beta Was this translation helpful? Give feedback.
-
It runs correctly, it outputs a file of 106 347 lines, I guess nothing's purged in it. |
Beta Was this translation helpful? Give feedback.
-
You need to set the NODE_ENV to production for the purging to happen |
Beta Was this translation helpful? Give feedback.
-
Oh right, indeed it works way better. And my classes are now appended to the output, which is nice ! What's the trick then ? I checked Any idea what's happening ? That's the first time I work with a post-processor I don't think I have enough knowledge about those things yet |
Beta Was this translation helpful? Give feedback.
-
Adding |
Beta Was this translation helpful? Give feedback.
-
I am using tailwind with vue in one of my projects, I imported the base style into my main.ts file and it worked as well. |
Beta Was this translation helpful? Give feedback.
-
The default strategy to decide wether or not to run I see you have now added this in your package.json script, which should make it work properly. If you want to handle that differently, you can take control of when to purge by adding an module.exports = {
purge: {
content: [
'./src/**/*.vue',
'./src/**/*.html',
'./src/**/*.js',
],
+. enabled: true // this would *always* run purge
},
}; Hope this helps! 👍 |
Beta Was this translation helpful? Give feedback.
-
Alright alright, I figured it out. The build command doesn't seem to take Special thanks to @sa3dany for leading me on the good path I'll update my original post to mention that the output is a library and not an app, and that the entry point is not the one we all think about. |
Beta Was this translation helpful? Give feedback.
Alright alright, I figured it out. The build command doesn't seem to take
main.ts
as the entry point when outputting as a library,App.vue
is. I moved the import instruction into the directory I'm building the library from and it works like a charm. Fixed in this commitSpecial thanks to @sa3dany for leading me on the good path
I'll update my original post to mention that the output is a library and not an app, and that the entry point is not the one we all think about.