handlebars-loader icon indicating copy to clipboard operation
handlebars-loader copied to clipboard

remove whitespaces

Open hoon720823 opened this issue 8 years ago • 1 comments

i'd like to add this code to line 172 to remove whitespaces. this will remove preceding and trailing white spaces.

if (!!query.removeWhiteSpace) {
          source = source.replace(/^[\s\uFEFF\xA0\x20\t]+|[\s\uFEFF\xA0\x20\t]+$/mg, ' ').replace(/[\r\n]/mg, '');
        }

hoon720823 avatar Sep 08 '17 07:09 hoon720823

Looking for the same.

Would maybe propose a "processcontent" option as in https://github.com/gruntjs/grunt-contrib-handlebars#processcontent

options: {
  processContent: function(content, filepath) {
    return content.replace(/^[\s\uFEFF\xA0\x20\t]+|[\s\uFEFF\xA0\x20\t]+$/mg, ' ').replace(/[\r\n]/mg, '');
  }
}

dev-bjoern avatar Dec 30 '18 16:12 dev-bjoern