It's been a while since I've done any work on Plone mockup and I'm now having trouble remembering the right way to make a change. Can someone point me to current instructions or help me out?
I tried this:
- Add a source checkout of mockup to my buildout.
- Run "make bootstrap" in the mockup directory
- Make my change
- Start Plone and put the plone-loggedin bundle into development mode.
But I just get script errors:
Loading failed for the
<script> with source “http://localhost:8081/plone/mockup-patterns-recurrence.js”. (this URL is a 404)
And a bunch of "XML Parsing Error: not well-formed" errors while reading various xml templates.
I also tried running "make bundle-plone" in the mockup directory, which succeeded, but I'm not sure what to do with the result. I need to update plone-loggedin-compiled.js in CMFPlone but I don't see this file in the mockup build directory after running "make bundle-plone".
To answer my own questions:
I eventually found the instructions in DEVELOPING_BUNDLES.rst in CMFPlone. Before this I had looked at the readme in mockup and at the developer docs, which didn't help me. I will try to follow up soon and move the instructions in DEVELOPING_BUNDLES.rst into the developer docs so they're easier to find.
The missing script may have been due to a missing upgrade step (this site was upgraded from Plone 4). I added it to the registry manually using the info in CMFPlone's registry.xml.
I'm still seeing the “XML Parsing Error: not well-formed” messages in Firefox but they don't seem to interfere with things working.
thanks for sharing, it cheers me to see that more competent people have trouble to find this -cleverly hidden in plain sight - info (I failed and used TTW compilation but it could come handy later)
The “XML Parsing Error: not well-formed” are due to xml templates which are loaded via requirejs. You can safely ignore them.
This is my workflow:
- Add mockup to source checkouts,
- Send the resource registry in development mode,
Then you just have to reload the page and see all changes immediately.
When I want to re-create the bundle I use
./bin/plone-compile-resources -b BUNDLENAME (See more options by passing
--help). You need somethins similar like that in buildout: https://github.com/plone/buildout.coredev/blob/59f8791d1419d23833316a694d134762a955cc4a/core.cfg#L56
Of course, the things in mockup's dev docs also apply. Especially the tests should pass.
I do not create any bundles via the grunt setup in mockup anymore.
The url "http://localhost:8081/plone/mockup-patterns-recurrence.js” is also wrong. See configure.zcml in mockup - this registerst some plone.resource directories and one of them points to mockup/mockup/patterns.
Right -- it was trying to use /plone/mockup-patterns-recurrence.js by default because mockup-patterns-recurrence was missing from my registry for some reason, so it was not included in the require.js config.
Thanks for confirming that the development workflow I eventually ended up with is also similar to yours. As I said, I'll follow up and make sure the documentation is up to date and in a better location.
Sometimes I find it's best to think of Zope/Plone as a puzzle adventure game.
I have to say - apart from being based on already ancient JS technologies - that workflow is pretty cool.