Seeing it is probably understanding i guess...
I forked and branched the idea here. Let me know if anyone things this is a good or bad idea themselves ;)
I've converted the demo content as it was into a folder (withing course/en) called structure aka hence the branch name...
Folders have a naming convention prefix :
- co - contentObject
- a - article
- b - block
- c - component
Every folder will contain a single json file which relates the the object itself, this json file is combined on build into the respective JSON.
The folder name dictates the id of the json object which goes inside it. (Auto done on build)
The parent folder will be the parentID of the object (Auto done on build - will walk folder structure if you've subfoldered e.g. html-stubs/ would be ignored and it would walk up the chain to something with a recognised prefix)
This does mean you can give json and html stubs more meaningful names to make the navigation of folders easier (in the readability sense)
I think it also makes it nice in that if you want readable folder names, you can have those too, just making sure your folders order correctly, there is nothing stopping you from adding more meta to the end of the folder name e.g. article-1-intro-to-topic, and this would become the id used in the JSON files it generates.
Finally the reason i did this to begin with, easier to edit HTML text in the JSON files was a little clumsy for my tastes so....
I've also created a notation for injecting text content e.g. HTML text into any JSON value attribute, which is an optional way to keep your text in a seperate file next to the json object, this could be handy if its :
- heavily styled e.g. html tag hell
- needs someone more designer-minded to edit markup but leave json alone
- translations/localising large body
One new bonus with all of this was the ease of restructuring, i just copy folders and to new locations e.g. move a block to another article can be done via folders not via searching for ID's in a long file... i like that anyway ;)
As said, feedback welcome. Can pull req this back in should people see value in it, just let me know. Its still a ways though from being tested fully, i'm sure it could be broke with something nasty like comments in HTML or the likes...
NB - if you get a [bad] Karma npm install, a temp fix is to just delete the karma folder in node_modules and run npm install karma again from root. It will fix it... not sure why.