allow addons to have images Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c7d07bc8 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c7d07bc8 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c7d07bc8
Branch: refs/heads/fauxton Commit: c7d07bc8f9f07d770e5f291f46628e34bedf92de Parents: 9d04753 Author: Simon Metson <[email protected]> Authored: Fri Feb 15 15:17:48 2013 +0000 Committer: Simon Metson <[email protected]> Committed: Fri Feb 15 15:17:48 2013 +0000 ---------------------------------------------------------------------- src/fauxton/grunt.js | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/c7d07bc8/src/fauxton/grunt.js ---------------------------------------------------------------------- diff --git a/src/fauxton/grunt.js b/src/fauxton/grunt.js index 99cd4dc..9dc7ddb 100644 --- a/src/fauxton/grunt.js +++ b/src/fauxton/grunt.js @@ -13,7 +13,7 @@ module.exports = function(grunt) { } } }; - + function processAddons(callback){ if (path.existsSync("settings.json")){ var settings = grunt.file.readJSON("settings.json") || {deps: []}; @@ -40,14 +40,15 @@ module.exports = function(grunt) { // Base assets var theAssets = { less:{ - paths: ["assets/less"], + paths: ["assets/less"], files: { "dist/debug/css/fauxton.css": "assets/less/fauxton.less" } - } + }, + img: ["assets/img/**"] }; - // Less files from addons processAddons(function(addon){ + // Less files from addons var root = addon.path || "app/addons/" + addon.name; var lessPath = root + "/assets/less"; if(path.existsSync(lessPath)){ @@ -56,11 +57,17 @@ module.exports = function(grunt) { theAssets.less.files["dist/debug/css/" + addon.name + ".css"] = lessPath + "/" + addon.name + ".less"; } + // Images + var root = addon.path || "app/addons/" + addon.name; + var imgPath = root + "/assets/img"; + if(path.existsSync(imgPath)){ + theAssets.img.push(imgPath + "/**"); + } }); - + grunt.log.write(theAssets.img[0]); return theAssets; }(); - + grunt.initConfig({ // The clean task ensures all files are removed from the dist/ directory so @@ -308,14 +315,14 @@ module.exports = function(grunt) { files:{ "dist/release/js/": "assets/js/**", //"dist/release/css/**": "assets/css/**" - "dist/release/img/": "assets/img/**" + "dist/release/img/": assets.img } }, debug:{ files:{ "dist/debug/js/": "assets/js/**", //"dist/debug/css/": "dist/release/css/**" - "dist/debug/img/": "assets/img/**" + "dist/debug/img/": assets.img } } },
