dwightjack / grunt-premailer

Grunt wrapper task for Premailer
MIT License
114 stars 16 forks source link

In 0.2.9 and 0.2.10, removes all HTML #25

Closed Sawtaytoes closed 9 years ago

Sawtaytoes commented 10 years ago

My HTML gets completely replaced w/ only this DOCTYPE declaration when using 0.2.9 and 0.2.10. I could not test 0.2.8 as npm threw errors. 0.2.7 works for me and is what I've reverted to.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

premailer.coffee:

module.exports =

    ########################################
    ## Premailer
    ########################################

    html:
        options:
            mode: 'html'
            preserveStyles: false
            removeClasses: true
            removeScripts: false
            verbose: false

        files: '<%= locations.html.files %>'

    txt:
        options:
            mode: 'txt'
            verbose: false

        files: '<%= locations.txt.files %>'

A piece of location-vars.coffee where the files reference is found:

    html:
        src: '<%= locations.pages.dest %>'
        dest: '<%= locations.pages.dest %>'
        files: [
            expand: true
            cwd: '<%= locations.html.src %>'
            src: '**/*.html'
            dest: '<%= locations.html.dest %>'
            filter: 'isFile'
        ]
toby1kenobi commented 10 years ago

I get the same thing, with 0.2.10 at least. Reverting to 0.2.7 also fixes it for me.

dwightjack commented 10 years ago

Hi will look into it asap.

Thanks for the contribution.

kris-ellery commented 9 years ago

It looks like this is still an issue. Tested 2.7 and 2.11, both failed. Reverting to 2.5 fixes it, but then it messes up some styling.

EDIT: 2.11 works if the dest file is different than source.

marocas commented 9 years ago

@dwightjack @KrisOlszewski Is right, i had to make a workaround on my workflow, the dest now is on the root of my project, then i delete my dist html files and copy the html from the root to my dist folder and delete them after. 2 more steps to get the work done.

dwightjack commented 9 years ago

Ok,

i think figured out the problem: since premailer was giving random error when destination file didn't existed, i was creating it before running premailer.

In a src === dest scenario this ended up parsing an empty file. :S

I just released 0.2.12 which should fix the issue. Tested with Ruby 1.9.3 + hpricot and Ruby 2.0.x with nokogiri.

Sorry for the delay in solving this issue.