-
-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Describe the bug
On the branch craft-vite Tailwind JIT is not recompiling the css when template changes occur in template files.
To reproduce
Steps to reproduce the behaviour:
composer create-project nystudio107/craft:dev-craft-vite vitecraft --no-install --remove-vcsmake dev- Load
http://localhost:8000in browser - Editing:
src/templates/index.twig - Add a paragraph to the template (confirms that auto reload is working and detecting changes to template files)
- Add a class to the paragraph eg:
<p class="bg-red-900"> - Auto re-load will occur again, but the background will not update.
- Reload the docker containers
ctrl-cthenmake dev - Reloading
http://localhost:8000after the Docker Project finishes restarting confirms a valid Tailwind class and that Tailwind will see and use the template file to rebuild the CSS.
Alternative option starting at step 4:
- Editing:
src/vue/App.vue - Add a paragraph to the vue template.
- Module will successfully re-load adding the paragraph.
- Add the class already added in (step 6 above) to the paragraph (background is added successfully).
- Change to a new class
class="bg-blue-900" - Changes will not show up until the docker project is re-loaded.
Expected behavior
A red background to appear at step 6. Or a blue background at step 5
Discussion
At first I thought this could be an issue with the Docker file system, but that doesn't follow with Vite successfully detecting template changes to cause the page re-load. And also properly reloading the Vue templates.
Then I thought it could be because ../src/templates/**/*.{twig,html} was pointing to a different source directory from ./src/vue/**/*.{vue,html}, but changing to ./src/templates/**/*.{twig,html} did not resolve the issue. Which led me to also test the Vue side of this.
Then I attempted simplifying the tailwind config:
// module exports
module.exports = {
mode: 'jit',
purge: [
'./src/templates/**/*.{twig,html}',
'./src/vue/**/*.{vue,html}',
],
theme: {
},
corePlugins: {},
plugins: [],
};Which also didn't resolve the issue (though still correctly resolves things on initial load).
So I think it is a path problem of some kind, but I can't work out how to correct it, because basically everything appears to be running on defaults.