-
Notifications
You must be signed in to change notification settings - Fork 19
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 doesn't compile #111
Comments
This seems to be a virtual env issue, if you have just install locally (if not run |
I think I've encountered this issue before. Looking at the form input, it appears to be styled with Tailwind rather than the default Django form style (which has none by default). Try adding a few elements / rows and see if at least the table layout looks right without the oversized arrow. Does it appear on all pages, or just the create and update form pages?
Do you mean the Tailwind command isn’t picking up the classes from the template being displayed? Interesting—I hadn't thought of that. If this is the case, try using this in your /** @type {import('tailwindcss').Config} */
const plugin = require("tailwindcss/plugin");
const { spawnSync } = require("child_process");
// Calls Django to fetch template files
const getTemplateFiles = () => {
const command = "python3";
const args = ["manage.py", "tailwind", "list_templates"];
// Assumes tailwind.config.js is located in the BASE_DIR of your Django project.
const options = { cwd: __dirname };
const result = spawnSync(command, args, options);
if (result.error) {
throw result.error;
}
if (result.status !== 0) {
console.log(result.stdout.toString(), result.stderr.toString());
throw new Error(
`Django management command exited with code ${result.status}`
);
}
const templateFiles = result.stdout
.toString()
.split("\n")
.map((file) => file.trim())
.filter(function (e) {
return e;
}); // Remove empty strings, including last empty line.
return templateFiles;
};
module.exports = {
content: [].concat(getTemplateFiles()),
theme: {
extend: {},
},
plugins: [
require("@tailwindcss/typography"),
require("@tailwindcss/forms"),
require("@tailwindcss/aspect-ratio"),
require("@tailwindcss/container-queries"),
plugin(function ({ addVariant }) {
addVariant("htmx-settling", ["&.htmx-settling", ".htmx-settling &"]);
addVariant("htmx-request", ["&.htmx-request", ".htmx-request &"]);
addVariant("htmx-swapping", ["&.htmx-swapping", ".htmx-swapping &"]);
addVariant("htmx-added", ["&.htmx-added", ".htmx-added &"]);
}),
],
}; I copied it from here. Essentially, it uses a Django command to list all templates, ensuring Tailwind detects them all. By the way, I’m sorry for the issues you're experiencing :(, I'll simplify a lot of this in the next release! |
Nice
This is probably a crispy-tailwind issue, the package that provide the tailwind styling for forms. |
Tailwind is incomplete on the CRUD pages created.
The text was updated successfully, but these errors were encountered: