Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix initialization bug.

  • Loading branch information...
commit 05e2eb414d8f43395ab542a38f751b27755d5bfc 1 parent 6157840
Josh Huckabee authored

Showing 1 changed file with 9 additions and 5 deletions. Show diff stats Hide diff stats

  1. +9 5 lib/assets.js
14 lib/assets.js
@@ -22,7 +22,7 @@ var fs = require('fs'),
22 22 'handlebars.js',
23 23 'app.js'
24 24 ],
25   - assetCache = {js: null, css: null, icons: []};
  25 + assetCache = {js: null, css: null, icons: {}};
26 26
27 27 function compressAssets() {
28 28 css.forEach(function(filename) {
@@ -89,7 +89,8 @@ function styles(options) {
89 89 });
90 90 assetCache.css = out.join('\n');
91 91 }
92   - return assetCache.css;
  92 +
  93 + return assetCache.css
93 94 }
94 95
95 96 function scripts(options) {
@@ -119,14 +120,16 @@ function scripts(options) {
119 120 ast = pro.ast_mangle(ast);
120 121 ast = pro.ast_squeeze(ast);
121 122
  123 + // Cach response and return
122 124 assetCache.js = '<script type="text/javascript">' + pro.gen_code(ast) + '</script>';
123   - return cache.js;
  125 + return assetCache.js;
124 126 }
125 127
126 128 function icon(imgFile, imgAttrs) {
127   - if (assetCache.icons[imgFile]) return assetCache.icons[imgFile];
128 129 var attrs = [], attr;
129 130
  131 + if (assetCache.icons[imgFile]) return assetCache.icons[imgFile];
  132 +
130 133 // Get source from image file
131 134 attrs.push('src="data:image/png;base64,'+ fs.readFileSync(public_dir + imgFile).toString('base64') + '"');
132 135
@@ -137,8 +140,9 @@ function icon(imgFile, imgAttrs) {
137 140 }
138 141 }
139 142
  143 + // Cache response and return
140 144 assetCache.icons[imgFile] = '<img ' + attrs.join(' ') + ' />';
141   - return assetCache.icons[imgFile]
  145 + return assetCache.icons[imgFile];
142 146 }
143 147
144 148 exports.setup = function(app) {

0 comments on commit 05e2eb4

Please sign in to comment.
Something went wrong with that request. Please try again.