Skip to content

Commit 982cb2d

Browse files
committed
Merge pull request #552 from blessenm/bom-precompilation-option
Added BOM removal flag.
2 parents 0f278e1 + 7538b85 commit 982cb2d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bin/handlebars

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ var optimist = require('optimist')
7070
'description': 'Template extension.',
7171
'alias': 'extension',
7272
'default': 'handlebars'
73+
},
74+
'b': {
75+
'type': 'boolean',
76+
'description': 'Removes the BOM (Byte Order Mark) from the beginning of the templates.',
77+
'alias': 'bom'
7378
}
7479
})
7580

@@ -147,6 +152,10 @@ function processTemplate(template, root) {
147152
});
148153
} else {
149154
var data = fs.readFileSync(path, 'utf8');
155+
156+
if (argv.bom && data.indexOf('\uFEFF') === 0) {
157+
data = data.substring(1);
158+
}
150159

151160
var options = {
152161
knownHelpers: known,

0 commit comments

Comments
 (0)