LastCallMedia / Mannequin

Mannequin Component Theming Tool
https://mannequin.io/
MIT License
38 stars 8 forks source link

Sticky Caching on Components? #94

Closed porkloin closed 7 years ago

porkloin commented 7 years ago

Loving Mannequin so far :)

However, several times I've experienced sticky caching issues with my components. I created one component "Button" at button.html.twig and then copy-pasted the contents into "Image" at image.html.twig. I changed the twig and variables, but forgot to change the name of the component, and now "Image" continues to be called "Button in my component library. This persists even through a restart of the mannequin process.

I'm going to guess this is being cached somewhere? I'm running Mannequin in very verbose (-vvv) and getting a clean log. I looked through the documentation for any help, but there wasn't anything that seemed immediately illuminating.

Thanks!

porkloin commented 7 years ago

A little more information:

If I copy image.html.twig to a file called images.html.twig it shows up as a new component with the correct name. Then if I delete image.html.twig I have two files remaining (button.html.twig and images.html.twig) both of which are listed in Mannequin under their correct names. However, when I move images.html.twig to image.html.twig, the name reverts to "button" automatically.

FWIW, this also happens with any variables and markup - once they're created and initially detected by Mannequin, the only way to modify the component and have the changes appear is to change the file name.

porkloin commented 7 years ago

Sorry for the spam, but I just realized there is a debug flag for the Mannequin executable. Output of debug follows:

mannequin-debug.txt mannequin-debug.txt

The first is when I have /base/button.html.twig and /base/image.html.twig, the second is when I have /base/images.html.twig included as well.

rbayliss commented 7 years ago

Hey @porkloin, Glad you're liking it so far! You're probably hitting Twig caching. You can work around it by passing 'auto_reload' as one of the twig options, like this. We should be setting this to true by default though, so I'm going to leave this issue open as a reminder to deal with that. Let us know if that doesn't cut it for you!

rbayliss commented 7 years ago

This should be resolved in 1.0.6. To update, you should be able to run: composer update lastcall/mannequin*.

rbayliss commented 7 years ago

Sorry - and by resolved I mean that you no longer need to explicitly set auto_reload on your configuration. It is the default.

porkloin commented 7 years ago

Woo, thanks @rbayliss! I really enjoyed your talk at BADCamp and am looking forward to messing with Mannequin more.