-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Tailwind problem when working with different folders #781
Comments
After some more testing, my guess is that Tailwind check the classes present in the maizzle repository, and prepare those classes. I tried adding a tailwind.config.js in the production/clients/client_a folder and in the config.local.js file:
And indeed it takes that tailwind.config.js file into account, but I still have the same problem about the classes. Am I missing something in the configuration file? Is it intended? Is it a bug? |
Hi there, This is how the JIT engine in Tailwind works, it only generates classes that it 'sees' used in one of the defined content sources. All you have to do is add that path to Tailwind's Maizzle configures Tailwind CSS with some default content sources (like your layouts/components/templates folders), but for anything else you need to add the paths to your Tip: don't add Note that Maizzle v4.2.2 was released yesterday, and it fixes an issue with the default content sources (not directly related to your issue, but I strongly recommend upgrading to it as it comes with performance improvements). |
Hello, Thank you so much for your help!
Is there a way to parametrize this path?
Or the define this path still elsewhere and use the variable in both the |
You could // tailwind config
const localConfig = require('./config.local.js')
module.exports = {
content: `${localConfig.path}{layouts,templates,components}/**/*.{html,js}`
} Mind the Btw, as you may have noticed - this should also work for the glob pattern: content: [
- '../Production/clients/nose/20220628_Transac_re-design/src/templates/**/*.{html,js}',
- '../Production/clients/nose/20220628_Transac_re-design/src/components/**/*.{html,js}',
- '../Production/clients/nose/20220628_Transac_re-design/src/layouts/**/*.{html,js}',
+ '../Production/clients/nose/20220628_Transac_re-design/src/{layouts,templates,components}/**/*.{html,js}',
], |
Hello, Unfortunately, I can't make it work. On my side, it looks like: //tailwind config
const localConfig = require('../../../maizzle/config.local.js')
//the path relative to my config.local.js file
module.exports = {
content: `${localConfig.path}src/{layouts,templates,components}/**/*.{html,js}`,
(...)
} The error I get is: //tailwind config
const localConfig = require('../../../maizzle/config.local.js')
module.exports = {
content: ['../production/clients/client_a/src/{layouts,templates,components}/**/*.{html,js}'],
(...)
} It works once again, so I assume there is something wrong about the way I use the But anyway, this doesn't solve the problem of setting a path in a tailwind.config.js file. Because first it was the path to the layouts, components and css. Now it will be the path to the config.local.js file relative to the tailwind.config.js. Or am I still missing something? |
|
Indeed, I saw that I had to point to the root directory. Sorry if this is obvious, I'm from the email world without much technical knowledge, but I'm trying to improve that! |
Sorry about that, I shortened the code for the example. You need to get the correct key from // In your tailwind.config.js
// First, get the Maizzle config
const localConfig = require('./config.local.js')
// Pass the `build.templates.destination.path` variable from Maizzle config to Tailwind's `content`
module.exports = {
content: `${localConfig.build.templates.destination.path}/{layouts,templates,components}/**/*.{html,js}`
} Mind the added |
Just saw this in Tailwind 3.2 which may be exactly what you need: I’ll try to publish a release today which will include Tailwind CSS 3.2, just need to run a few more tests 👍 |
That seems indeed to resolve the problem :-) I would be happy to test it once it is in the new release! |
It's been released in v4.2.0, give it a try. |
Hello, I am on v4.3.0 at the moment, but I have a new problem: Error:` Failed to find 'tailwindcss/components'
in [
/xxx/production/clients/client_a/src/css
] If I install the nodes_module in the I'm pretty sure it worked a few days ago with the same config (I need to test it with and older npm version). I tried playing with the // In tailwind.config.js
content {relative: true,} but I couldn't make it work. I also tried with the
/* in tailwind.css */
@config "../../tailwind.config.js" Do you know if some changes were made? |
Support for |
Hello,
I encounter a problem that I can't reproduce consistently.
Here it is:
I configured a repository "production" as follow:
And a second repository "maizzle" which is a fork from
https://github.com/maizzle/maizzle
In the repo "maizzle", I have a config.js as follow:
and a config.local.js as follow:
So the idea is to have a maizzle repository from where we can build htmls from sources in another folder.
When I run run
maizzle build local
, I sometimes have a very strange behavior in the built HTML:Some of the tailwind commands does not work anymore. For example,
class="p-15"
will indeed give me astyle="padding: 15px;"
, but aclass="py-15"
won't work.I tested several things, and if the files (tailwind.css, templates, layouts and components) in the maizzle repo and the production repo are the same, then the
maizzle build local
will work smoothly. But if the files in the maizzle repo are the default ones, then themaizzle build local
will have the strange behavior described.Note:
The idea behind this is to have a repo for a fork from maizzle to keep upgrading it easily, and without risking any problem with our clients
The text was updated successfully, but these errors were encountered: