Skip to content

Commit

Permalink
Merge pull request #552 from blessenm/bom-precompilation-option
Browse files Browse the repository at this point in the history
Added BOM removal flag.
  • Loading branch information
kpdecker committed Jun 5, 2013
2 parents 0f278e1 + 7538b85 commit 982cb2d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ var optimist = require('optimist')
'description': 'Template extension.',
'alias': 'extension',
'default': 'handlebars'
},
'b': {
'type': 'boolean',
'description': 'Removes the BOM (Byte Order Mark) from the beginning of the templates.',
'alias': 'bom'
}
})

Expand Down Expand Up @@ -147,6 +152,10 @@ function processTemplate(template, root) {
});
} else {
var data = fs.readFileSync(path, 'utf8');

if (argv.bom && data.indexOf('\uFEFF') === 0) {
data = data.substring(1);
}

var options = {
knownHelpers: known,
Expand Down

0 comments on commit 982cb2d

Please sign in to comment.