Email-builder / grunt-email-builder

Build Emails from HTML / CSS code in grunt
Other
94 stars 14 forks source link

encodeSpecialChars not working #38

Closed levi-putna closed 9 years ago

levi-putna commented 9 years ago

My mail template uses php to render dynamic content before sending. The PHP tags are getting turned into special characters.

The following HTML + PHP <p>Hi <?= $member->getDisplayName(); ?>,</p>

Will be output as <p style="...">Hi getDisplayName(); ?&gt;,</p>

According to the documentation adding the encodeSpecialChars: false option should prevent the tags being rendered as special characters. This doesn't seem to work, characters are still getting encoded.

Attached is the Grunt configuration used.

emailBuilder: {
    production: {
        files: [{
            options  : {
                encodeSpecialChars: false
            },
            expand: true, // Enable dynamic expansion.
            cwd      : 'protected/email_template',
            src      : ['*.php'], 
            dest     : 'protected/views/email/', 
            ext      : '.php' 
        }]
    }
},
jeremypeter commented 9 years ago

This is an issue with the version of juice we're using...similar to this issue : https://github.com/Automattic/juice/issues/57

The next version of Email Builder will use the updated juice v1.0.0 module and should resolve this. I will keep this open for now.

levi-putna commented 9 years ago

Thanks @jeremypeter, I did a little testing with Juice 1.0.0, it seems to fix this issue. I'm happy to do some testing of the next version of Email Builder when ready.

A temporary workaround has been to use a template tag in the email and add do a replace with the php script after Email Builder has finished. I'm using grunt-replace.

jeremypeter commented 9 years ago

Version 3.0.0 should resolve this now that it uses Juice 1.0.0