Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix initialization bug.

  • Loading branch information...
commit 05e2eb414d8f43395ab542a38f751b27755d5bfc 1 parent 6157840
Josh Huckabee authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/assets.js
14 lib/assets.js
View
@@ -22,7 +22,7 @@ var fs = require('fs'),
'handlebars.js',
'app.js'
],
- assetCache = {js: null, css: null, icons: []};
+ assetCache = {js: null, css: null, icons: {}};
function compressAssets() {
css.forEach(function(filename) {
@@ -89,7 +89,8 @@ function styles(options) {
});
assetCache.css = out.join('\n');
}
- return assetCache.css;
+
+ return assetCache.css
}
function scripts(options) {
@@ -119,14 +120,16 @@ function scripts(options) {
ast = pro.ast_mangle(ast);
ast = pro.ast_squeeze(ast);
+ // Cach response and return
assetCache.js = '<script type="text/javascript">' + pro.gen_code(ast) + '</script>';
- return cache.js;
+ return assetCache.js;
}
function icon(imgFile, imgAttrs) {
- if (assetCache.icons[imgFile]) return assetCache.icons[imgFile];
var attrs = [], attr;
+ if (assetCache.icons[imgFile]) return assetCache.icons[imgFile];
+
// Get source from image file
attrs.push('src="data:image/png;base64,'+ fs.readFileSync(public_dir + imgFile).toString('base64') + '"');
@@ -137,8 +140,9 @@ function icon(imgFile, imgAttrs) {
}
}
+ // Cache response and return
assetCache.icons[imgFile] = '<img ' + attrs.join(' ') + ' />';
- return assetCache.icons[imgFile]
+ return assetCache.icons[imgFile];
}
exports.setup = function(app) {
Please sign in to comment.
Something went wrong with that request. Please try again.