fbrctr / fabricator

A tool for building website UI toolkits and style guides
http://fbrctr.github.io/
MIT License
1.11k stars 124 forks source link

Inject Data Into Assembly.data #284

Open camdagr8 opened 7 years ago

camdagr8 commented 7 years ago

I was wondering if there was a way to inject data into the assembly.data object.

I see the parseData() function in the assembler but don't see a means to inject anything into that object w/o modifying the parseData() function.

If there was a config option for this similar to the helpers, that would be great. I'd like to avoid modifying the assembler.

camdagr8 commented 7 years ago

As a follow up to this, I'm trying to create a dependency tracker so that I can see where partials are being used so that I can quickly asses risk caused by changes.

I've come up with a decent work around that involved me creating a version of the parseMaterials() function in my gulp file and writing data to a .json file. I triggered the function in the assembler:watch task.

This however caused me to have to exclude the .json file from the config.templates.watch array. And specify the config.materials and config.views values (even though they are the same as what is being used by default, I needed the values for my custom parse function).

It would be really cool to be able to inject that info into the assembly so that it could be used like the views and materials object.