Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #31 from jaketrent/master
Browse files Browse the repository at this point in the history
Add ability to specify template extension
  • Loading branch information
niftylettuce committed Jan 1, 2013
2 parents eedb482 + 87ebed6 commit a8fb28a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/main.js
Expand Up @@ -203,7 +203,7 @@ var compile = function(fileName, assets, S3, options, method, type, timestamp, c
//throwError('unsuccessful upload of stylesheet "' + fileName + '" to S3');
console.log('unsuccessful upload of stylesheet "' + fileName + '" to S3');
return finishUpload();
} else {
} else {
logger({ task: 'express-cdn', message: 'successfully uploaded stylesheet "' + fileName + '" to S3' });
return finishUpload();
}
Expand All @@ -221,7 +221,7 @@ var compile = function(fileName, assets, S3, options, method, type, timestamp, c
});
optipng.on('exit', function(code) {
// OptiPNG returns 1 if an error occurs
if (code != 0)
if (code != 0)
throwError('optipng returned an error during processing \'' + img + '\': ' + code);

logger({ task: 'express-cdn', message: 'optipng exited with code ' + code });
Expand Down Expand Up @@ -287,7 +287,7 @@ var compile = function(fileName, assets, S3, options, method, type, timestamp, c
} else {
logger('successfully uploaded image "' + fileName + '" to S3');
// Hack to preserve original timestamp for view helper
try {
try {
fs.utimesSync(image, new Date(timestamp), new Date(timestamp));
return finishUpload();
} catch (e) {
Expand Down Expand Up @@ -469,8 +469,9 @@ var CDN = function(app, options, callback) {
, results = []
, regexCDN = /CDN\(([^)]+)\)/g;
walker.on('file', function(root, stat, next) {
var validExts = options.extensions || ['.jade', '.ejs'];
var ext = path.extname(stat.name), text;
if (ext === '.jade' || ext === '.ejs') {
if (_.indexOf(validExts, ext) !== -1) {
fs.readFile(path.join(root, stat.name), 'utf8', function(err, data) {
if (err) throwError(err);
var match;
Expand Down

0 comments on commit a8fb28a

Please sign in to comment.