Nuxt Layers
I'm so excited for nuxt layers! I think it's a fantastic feature, so thanks to all that have worked on it!
I've just started working with layers and used the starter theme project to setup a layer and added a few modules (tailwind etc) and it all seems to be working nicely. I include the layer into another project and tailwind and my components are all there and seem to work. The only thing that's not working is that any components from the layer that contain tailwind classes remain unstyled in the project the layer is imported to. These are standard tailwind classes that work if I use them elsewhere in the project, but the classes on these imported components do not work. It seems like some sort of scoping issue, but I can't figure it out.
I've looked at https://github.com/Atinux/content-wind-template and
content-wind
projects to see if I can figure it out and it all JustWorks(™)...
I started with a private npm layer (hosted on github), but I'm now working on a basic, local layer to keep things simple (still experiencing the same).
Has anyone had any experience with layers that might be able to shed some light?GitHub
GitHub - Atinux/content-wind-template: Template for Content Wind Nu...
Template for Content Wind Nuxt theme. Contribute to Atinux/content-wind-template development by creating an account on GitHub.
8 Replies
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
Thanks for taking the time to reply Chris (don't now how I missed your reply). I actually published it as a private package on github packages because of this exact reason, but I had the same issue. I'll continue digging and post any findings here, in case it helps others.
Hey, I think we're running into the same issue with our project. The first suspicion we had is that tailwinds jit compiler only looks at the files in the main project, not the one you're extending off of
Sounds very plausible for custom classes/styles, but the styles I'm using are standard tailwind styles (in this case). If you're also experiencing this issue, perhaps it's indicative of a bigger problem?
It's just super weird, seeing as atinux's example just works. Hmm...I just had a thought to check the nuxt versions. Atinux's example uses 3.2.2, I'm currently on 3.2.0. I'll upgrade and try again, but I don't hold out too much hope.
It's just super weird, seeing as atinux's example just works. Hmm...I just had a thought to check the nuxt versions. Atinux's example uses 3.2.2, I'm currently on 3.2.0. I'll upgrade and try again, but I don't hold out too much hope.
Default tailwind classes are also being jit compiled
Are you by chance using the srcDir prop in your projects?
I'm embarrased to say I don't even know what the srcDir prop is π π
Just looked it up. Nope, using the default
huh I see
well for me it was happening because the repo you extend off of cant have a srcDir defined
so removing that made tailwinds jit pick up the classes again
if you can't find a solution then easiest would probably be posting a reproduction
Great, thanks! I'll take another look and posta reporoduction if I cna't figure it out