-
Notifications
You must be signed in to change notification settings - Fork 190
Some styles are not applied in production mode with "srcDir" nuxt.config.js option. #114
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
Comments
@peterkimzz I am currently running into the same problem. I found that the problem is caused by PurgeCSS, which is a tool that strips all unused CSS from your application build. This way whatever Tailwind utitilies you don't use are also not shipped to the user, resulting in smaller payloads and thereby better performance. In my project I write my pages and components in |
It appears as if the same issue occurs when the nuxt.config.js is in a subdirectory of the package.json and the rootDir is specified via an argument of the nuxt command, as described in example 2 on this page: https://nuxtjs.org/api/configuration-srcdir/ As @nielsdB97 experienced, the |
I'm having a similar issue. If I convert the relative paths to absolute paths it works no problem. I've noticed a few other modules do a conversion using srcDir before passing to purgeCSS. A good example of that is the nuxt-bulma-slim. Is this something we should be doing for this module too? See link for an example. |
To demonstrate the problem I have created a demo repository. The master branch is a nearly default nuxt init, whereas the linked When running
I hope this will be helpful in resolving the issue. Thanks in advance! |
Until this issue will get resolved I found this temporary workaround based on @husarcik his comment: tailwind.config.js import nuxtConfig from "./nuxt.config";
export default {
purge: {
content(defaultContents) {
return defaultContents
.map((path) => join(nuxtConfig.srcDir, path))
.map((file) => file.replace(".js", ".ts"));
}
}
} |
Hi, can you confirm this bug with the version 3 of this module? |
I can confirm this issue still occurs. I just pulled down https://github.com/nielsdB97/nuxt-tailwind-purge-demo/tree/src-dir and replicated the problem with version 3 of the module. |
Hi @misikoff First, you need to move Then you will see a message saying: Merging Tailwind config from ~/tailwind.config.js I actually merged #170 and released the v3.1.0 supporting the |
@atinux It seems to me that when using the new config file format (passing in parameters and returning a function), Tailwind isn't properly reading the config at all. When migrating our existing config to the new format (and updating to v3.1.0), none of our config options are applied. If I revert it back to the old format (still on v3.1.0), everything works correctly. |
@aaronhuisinga this is another issue, please create one with a reproduction please. |
Uh oh!
There was an error while loading. Please reload this page.
Version
@nuxtjs/tailwindcss: 2.0.0
nuxt: 2.12.0
What is actually happening?
Hi, this is Peter.
I tried to install this module, worked perfectly in dev mode, but some tailwind css has not been applied when I executed
nuxt build
andnuxt start
.Without "srcDir" option in production mode
As you can see, tailwind's class styles
.bg-black
and.container
are applied.With "srcDir" options in production mode
The problem is that
.container
style is applied,.bg-black
is not applied with all scripts are insrcDir
.I tried to install all dependencies by using both
npm
andyarn
, but got same result.Please let me know If my configuration is wrong! Thank you.
[10, August]
@nuxtjs/tailwindcss has been updated from 2.x to 3.0, still got same issue.
The text was updated successfully, but these errors were encountered: