Added BOM removal flag.

Byte order mark is now removed from the beginning of the files when b
flag is used.
This commit is contained in:
Blessan Mathew
2013-06-04 23:06:40 +05:30
parent 0f278e1dfc
commit 7538b8556c
+9
View File
@@ -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'
}
})
@@ -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,