couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [6/7] git commit: Updated the grunt task for making addons to include an option to make assets folder for .less files
Date Mon, 25 Feb 2013 03:34:35 GMT
Updated the grunt task for making addons to include an option to make assets folder for .less
files


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/66286e9a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/66286e9a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/66286e9a

Branch: refs/heads/fauxton
Commit: 66286e9a4688200d67091e0fbbe56957b5833a10
Parents: c7d07bc
Author: suelockwood <deathbearbrown@gmail.com>
Authored: Fri Feb 15 12:48:11 2013 -0500
Committer: suelockwood <deathbearbrown@gmail.com>
Committed: Fri Feb 15 12:48:11 2013 -0500

----------------------------------------------------------------------
 src/fauxton/tasks/fauxton.js  |   24 ++++++++++++++++++++++--
 src/fauxton/writing_addons.md |    5 +++++
 2 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/66286e9a/src/fauxton/tasks/fauxton.js
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/fauxton.js b/src/fauxton/tasks/fauxton.js
index a08a561..78b50f3 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();

http://git-wip-us.apache.org/repos/asf/couchdb/blob/66286e9a/src/fauxton/writing_addons.md
----------------------------------------------------------------------
diff --git a/src/fauxton/writing_addons.md b/src/fauxton/writing_addons.md
index a41af53..6d3f87b 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


Mime
View raw message