Details
I'm attempting to write a remarkup rule that would require some particular javascript libraries to be present. I'm pretty sure it looks like this, but can't figure out how to actually include the resources in the response.
- Dump the resources into my repo
- Annotate those resources for celerity
- Extend CelerityResourcesOnDisk to describe where my stuff is
- Run celerity
- ???
Answers
Basically it should be:
@provides my-resource-js-css should go in your files
require_celerity_resource('my-resource-js-css') should go in the new remarkup file
bin/celerity map builds the resources
See also https://secure.phabricator.com/book/phabdev/article/celerity/
With all the caveats of T5447:
require_celerity_resource('your-resource-name', 'your-map-name'); during rendering in your rule body, where your-resource-name is annotated as @provides your-resource-name in the header of your JS/CSS file.
Note that you can't currently @requires across maps, so if you write some JS that needs core Javelin stuff you'll have to manually require_celerity_resource(...) it alongside your callsite. I'm also not sure if it's possible to get Javelin::initBehavior() working with behaviors in third-party maps right now or not.
Generally, this stuff is modularized somewhat but not all of the kinks have been ironed out. I think third-party apps also have no access to spriting right now, and probably can't define CSS variables.