tmrts / boilr

:zap: boilerplate template manager that generates files or directories from template repositories
Apache License 2.0
1.73k stars 118 forks source link

Unwanted Whitespace #9

Closed rawkode closed 8 years ago

rawkode commented 8 years ago

When composing slightly more complicated templates, there's no way to trim the whitespace.

Example:

my_key:
    my_super_app: {{ template app_type }}
    my_super_app_version: {{ template app_version }}

{{ define "template_app_type" }}
{{ if eq app_type "php" }}
    {{ if eq php_version "7" }}
        php_7
    {{ else if eq php_version "5" }}
        php_5
    {{ end }}
{{ else if eq app_type "ruby" }}
    ruby
{{ end }}
{{ end }}

Outputs:

my_key:
    my_super_app: 

        php_7
    my_super_app_version: version

I know | trimSpace exists, but not when using template. Also go template support {{- -}} - but that doesn't seem to work with boilr?

Please advise when you can - I'm assuming maybe I'm doing something wrong :)

tmrts commented 8 years ago

This problem is related to Golang templates AFAIK, I've also tried '{{- -}}' and it didn't work. I'll track the cause of the problem and see why {{- -}} isn't working.

Thanks for reporting @rawkode :+1:

rawkode commented 8 years ago

Awesome - thanks.

I'd be keen to get involved, it's an awesome project. If you can tag some issues / feature requests as "low hanging fruit" or something, that would help me ease in :smile:

Cheers

tmrts commented 8 years ago

Thanks for the offer!

I'll go over the code base and create starter issues for possible enhancements.

In the meantime feel free to report the smallest problems you have :smile:

tmrts commented 8 years ago

I've investigated the problem and the {{- -}} syntax requires Go >= 1.6.

I updated the build version, starting form 0.3.0, only Go 1.6 will be supported.

You can compile boilr from source to get this feature, if you don't want to wait for 0.3.0