-
Notifications
You must be signed in to change notification settings - Fork 0
Assets
conoremclaughlin edited this page Jan 22, 2013
·
2 revisions
servers/Route#assets stores all arrays of mirrors and/or filepaths to assets to be sent to the client. servers/Route#initializeAssets converts these into mirrors and exposes their content at assets/<mirror>.<type>
The defaults mirrors are:
-
all.jsall assets in a single file - compiled from [vendor, core, main, plugins] -
main.jsapplication code - compiled from [models, templates, views, routers] -
plugins.jsplugins interacting directly with Bones and/or application code (ie. most files in a client or shared folder). -
core.jscore functionality on client for Bones, receives no wrapping beyond closure -
vendor.jsfiles that do not know of bones at all. plugins like backbone-forms could be added to plugin.js as well. -
templates.jsall templates. -
models.jsall models. -
views.jsall views. -
routers.jsall routers.
-
Route#exposeClientCore(filename)adds resolved filepath to core. -
Route#exposeClientVendor(filename)adds resolved filepath to vendor. -
Route#exposeClientPlugin(filename)adds resolved filepath to plugin. -
Route#loadClientPlugin(pluginDir)loads all files inpluginDir/clientandpluginDir/shared. -
Route#loadClientPlugins(Bones.plugin)loads/clientand/sharedfor all Bones plugins. Only use if require order irrelevant.
- Files in plugins.js are wrapped so they have access to templates, routers, models, views, and Bones itself.
- Mirrors read from the disk every time their url end point is requested. You either need to put a reverse-proxy in front of it, or publish static files as part of your build process. See publishing.
How do I add a file to a mirror?
Augment the initialize method of Route and add to this.assets.<mirror> a resolved filepath or use a convenience method below.