Thorax Plugin package.json format

syntacticx edited this page May 22, 2012 · 5 revisions
Clone this wiki locally

Thorax plugins are git repos with containing files to be copied to a target Thorax project. Each Thorax plugin should have it's own git repository containing a package.json file with a "thorax" object, which may contain any of the following:

  • lib
  • views
  • collections
  • models
  • routers
  • styles
  • generators
  • templates

Template must contain an object with arrays of templates indexed by view ({view:[template, template]}). All other keys must be an array containing either:

  • string path
  • object containing:
    • "src" string path
    • "global" boolean, will be copied into the entry in lumbar.json
    • "module" string module name, false if the file should be copied but not added to the target project's lumbar.json
    • "before" string filename, attempt to insert the entry after the matching filename (filename only, not full path) in the target project's lumbar.json
    • "after" string filename, just like before but.... after

All paths are relative to the plugin's repository. Specifying only a string will add the file to the base module, adding it at the end of the list of libs, views, etc. An example config:

  "thorax": {
    "lib": [
      {"src": "js/lib/thorax.loading.js", "module": "base", "after": {"lib": "thorax.js"}}
    "views": [
    "styles": [
      {"src": "styles/", "module": false}
    "templates": {
      "js/lib/thorax.loading.js": [