Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

add processContent option #50

Merged
merged 2 commits into from
Apr 7, 2016

Conversation

romanyanke
Copy link
Contributor

It removes leading and trailing spaces to shorten templates like grunt-contrib-handlebars does.
https://github.com/gruntjs/grunt-contrib-handlebars#processcontent

return content
.replace(/^[\x20\t]+/mg, '')
.replace(/[\x20\t]+$/mg, '')
.replace(/[\r\n]/g, '');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is just the test, but isn't this kind of transformation dangerous? What about <pre> tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will remove all spaces in <pre> tag for sure 😬. But the regular expression can be easily modified due your requirements.

@kirbysayshi
Copy link
Collaborator

Hello @romanyanke, thanks for the contribution! Before I merge this, could you add an entry to the README.md file in the Options section?

@kirbysayshi kirbysayshi merged commit 391cd55 into esamattis:master Apr 7, 2016
@kirbysayshi
Copy link
Collaborator

Thanks! Published as v2.6.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants