Tailwind ignores Vue.js SFC template classes #5591
-
What version of Tailwind CSS are you using? 2.2.15 What build tool (or framework if it abstracts the build tool) are you using? Webpack + PostCSS + vue-loader @fullhuman/postcss-purgecss:^4.0.3, @tailwindcss/forms:^0.2.1, @vue/compiler-sfc:^3.2.16, autoprefixer:^10.3.5, compression-webpack-plugin:^7.1.2, css-loader:^5.2.7, css-minimizer-webpack-plugin:^1.3.0, file-loader:^6.2.0, image-webpack-loader:^7.0.1, img-optimize-loader:^1.0.7, mini-css-extract-plugin:^1.6.2, postcss:^8.3.7, postcss-loader:^4.2.0, style-loader:^2.0.0, svgo:^2.7.0, tailwindcss:^2.2.15, vue-loader:^16.8.1, webpack:^5.53.0, webpack-cli:^4.8.0, webpack-dev-server:^3.11.2 @flowjs/flow.js:^2.14.1, lodash:^4.17.21, vue:^3.2.16 What version of Node.js are you using? v14.17.6 What browser are you using? N/A What operating system are you using? Kubuntu 20.04 LTS Reproduction URL N/A Describe your issue Tailwin ignores the class specified in the section inside the .vue file. Expansion @ directives in the <style> section work fine. Classes are not processed in build mode or in JIT mode. Webpack build commands:
/package.json
/resources/webpack.config.js
/resources/tailwind.config.js
/resources/postcss.config.js
/resources/main.js
/index.html
/resources/js/vue/test.vue
In test.vue, the first line is not pink, the second line is purple. Any idea? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey! My guess is that this is wrong:
The Vue file is If you can provide an actual reproduction repository that someone can quickly clone and play with that will help a lot, unfortunately it's just too much work to recreate a project from scratch by copying all this code by hand. |
Beta Was this translation helpful? Give feedback.
-
Your purge config is wrong it should be this.
While you're correct the path would be correct from the tailwind file itself, the paths are relative to the top level not to the file. The proof of this is how your html file is in the top level not the resources folder but the purge works. I verified by downloading your project and setting this which does indeed add bg-pink-900 to the build output. |
Beta Was this translation helpful? Give feedback.
Your purge config is wrong it should be this.
purge: ['./**/*.tpl','./*.html','./resources/js/vue/*.vue']
While you're correct the path would be correct from the tailwind file itself, the paths are relative to the top level not to the file. The proof of this is how your html file is in the top level not the resources folder but the purge works.
I verified by downloading your project and setting this which does indeed add bg-pink-900 to the build output.