dciccale/grunt-processhtml

build:template:target doesn't honor target

wlingke opened this issue · 4 comments

I tried to process an html with:

<!-- build:template:dist
<p>Hello, <%= name %></p>
/build -->

and ran it with the grunt task: grunt processhtml:staging and it compiled that block

paste the relevant part of your gruntfile pls

        processhtml: {
            options: {
                strip: true
            },
            dist: {
                files: {
                    "production/views/index.html": ['views/index.html']
                }
            },
            staging: {
                files: {
                    "production/views/index.html": ['views/index.html']
                }
            }
        },

I tested this with a build:css:dist and the target on the css build worked as expected (ie worked when i called grunt processhtml:dist and skipped it when I called grunt processhtml:staging)

try removing strip: true

if you run grunt processhtml:staging with strip set to true, the comment tags of <!-- build:template:dist will be removed.

if you do need the strip option, apply it locally

        processhtml: {
            dist: {
                options: {
                    strip: true
                },
                files: {
                    "production/views/index.html": ['views/index.html']
                }
            },
            staging: {
                files: {
                    "production/views/index.html": ['views/index.html']
                }
            }
        }

i think the previous comment fixes your issue. feel free to reopen if you continue having some issue.