summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuelockwood <deathbearbrown@gmail.com>2013-02-15 12:48:11 -0500
committersuelockwood <deathbearbrown@gmail.com>2013-02-15 12:48:11 -0500
commit66286e9a4688200d67091e0fbbe56957b5833a10 (patch)
treed837973b8b7fc760dc59922709d3a56796498f07
parentc7d07bc8f9f07d770e5f291f46628e34bedf92de (diff)
downloadcouchdb-66286e9a4688200d67091e0fbbe56957b5833a10.tar.gz
Updated the grunt task for making addons to include an option to make assets folder for .less files
-rw-r--r--src/fauxton/tasks/fauxton.js24
-rw-r--r--src/fauxton/writing_addons.md5
2 files changed, 27 insertions, 2 deletions
diff --git a/src/fauxton/tasks/fauxton.js b/src/fauxton/tasks/fauxton.js
index a08a56130..78b50f377 100644
--- a/src/fauxton/tasks/fauxton.js
+++ b/src/fauxton/tasks/fauxton.js
@@ -25,6 +25,11 @@ module.exports = function(grunt) {
name: "path",
message: "Location of add ons",
default: "app/addons"
+ },
+ {
+ name: "assets",
+ message: "Do you need an assets folder? (for .less)",
+ default: 'y/N'
}
];
@@ -51,14 +56,29 @@ module.exports = function(grunt) {
var done = this.async()
grunt.helper('prompt', {}, prompts, function (err, result) {
if (err) { return onErr(err); }
- var module = result.name
+ grunt.log.writeln(result.assets);
+ var module = result.name,
+ assets = result.assets;
+ if (assets == 'y') {
+ //if you need an assets folder
+ filepath = result.path + '/' + module.toLowerCase() + '/assets/less';
+ grunt.file.mkdir(filepath);
+ lessfile = {
+ name: 'less',
+ filename: module.toLowerCase()+'.less',
+ template: '//<%= module %> styles'
+ }
+ lessfile.module = module.charAt(0).toUpperCase() + module.substr(1);
+ var content = grunt.template.process(lessfile.template, lessfile);
+ grunt.file.write(filepath + '/' + lessfile.filename, content);
+ }
filepath = result.path + '/' + module.toLowerCase() + '/templates';
grunt.file.mkdir(filepath);
filepath = result.path + '/' + module.toLowerCase();
_.each(addonTemplates, function(file){
file.module = module.charAt(0).toUpperCase() + module.substr(1);
var content = grunt.template.process(file.template, file);
- grunt.file.write(filepath + '/' + file.filename, content)
+ grunt.file.write(filepath + '/' + file.filename, content);
});
grunt.log.writeln('Created addon ' + result.name + ' in ' + result.path);
done();
diff --git a/src/fauxton/writing_addons.md b/src/fauxton/writing_addons.md
index a41af53e3..6d3f87bc0 100644
--- a/src/fauxton/writing_addons.md
+++ b/src/fauxton/writing_addons.md
@@ -9,6 +9,10 @@ have the following structure:
* routes.js - _URL routing for the addon_
* views.js - _views that the model provides_
+ [optional]
+ * assets/less
+ * my_addon.less
+
## Generating an addon
We have a grunt task that lets you create a skeleton addon, including all the
boiler plate code. Run `bbb addon` and answer the questions it asks to create
@@ -21,6 +25,7 @@ an addon:
Please answer the following:
[?] Add on Name (WickedCool) SuperAddon
[?] Location of add ons (app/addons)
+ [?] Do you need an assets folder?(for .less) (y/N)
[?] Do you need to make any changes to the above before continuing? (y/N)
Created addon SuperAddon in app/addons