diff options
author | Simon Metson <simon+github@cloudant.com> | 2013-02-15 15:17:48 +0000 |
---|---|---|
committer | Russell Branca <chewbranca@gmail.com> | 2013-03-15 14:35:40 -0700 |
commit | 152786d5b5b9c5b045574faae4f146a071c74595 (patch) | |
tree | d008ec17eb51e8d63ecc395fef8eceb1927578fb | |
parent | 2693bb9f0cf9f99a23f6905e37ddc5793f32b230 (diff) | |
download | couchdb-152786d5b5b9c5b045574faae4f146a071c74595.tar.gz |
allow addons to have images
-rw-r--r-- | src/fauxton/grunt.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/fauxton/grunt.js b/src/fauxton/grunt.js index 37d3a7b6e..33ec8ad79 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 @@ -309,14 +316,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 } } }, |