walmartlabs/lumbar — pull request #60 by syntacticx (2012-05-19 22:30:00+00:00)
Title: Thorax plugin

Kevin, this is not ready for a merge but I wanted to start a discussion on this. This plugin attempts to add the following resources to the config automatically (only if the file / directory exists):

per module:

"styles": [
"{{pathToStyles}}/{{moduleName}}.styl"
],
"scripts": [
"{{pathToModels}}/{{moduleName}}",
"{{pathToCollections}}/pharmacy",
"{{pathToViews}}/{{moduleName}}",
"{{pathToRouters}}/{{moduleName}}.js"
]

per view:

"js/views/module/view.js": [
"templates/module/view.handlebars",
"templates/module/view-item.handlebars",
"templates/module/view-empty.handlebars"
]

The module side of things is working like a charm, but I can't get the templates to be picked up. I've tried modifying using the resourceList and got this error "Scoped files may not appear before global files" no matter if I used push, or unshift. I also tried modifying the module.config.attributes directly, but that didn't work either. Can you provide an example of how to modify the templates array?

In terms of using this in Phoenix, the following entries would be generated by this plugin that are not already present:

- styles/components/taxonomy.styl (needs name change since the taxonomy module doesn't actually load it)
- js/views/qr (ok, can remove existing declarations)
- js/views/location (ok, probably need to include js/views/location/base.js first)
- js/models/pharmacy (ok)
- js/views/pharmacy (ok)

All of the other script and style declarations that this plugin would generate are already present in the manually generated file and would become optional after this plugin was running. No modification would be required at all to the templates configuration. About 50% of the template configuration conforms exactly to what this plugin would generate and could be removed.