summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Metson <simon+github@cloudant.com>2013-02-15 15:17:48 +0000
committerSimon Metson <simon+github@cloudant.com>2013-02-15 15:17:48 +0000
commitc7d07bc8f9f07d770e5f291f46628e34bedf92de (patch)
tree2c685fecd79e3422b8ce091f3136734fc5fd0e3c
parent9d04753f8a0b33ab372aa280e484617475153677 (diff)
downloadcouchdb-c7d07bc8f9f07d770e5f291f46628e34bedf92de.tar.gz
allow addons to have images
-rw-r--r--src/fauxton/grunt.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/fauxton/grunt.js b/src/fauxton/grunt.js
index 99cd4dc52..9dc7ddb51 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
}
}
},