patrickkettner/grunt-compile-handlebars

append to dest instead of replacing the file

beygi opened this issue · 3 comments

grun file part

        'compile-handlebars': {
            allStatic: {
                files: [{
                    src: 'pages/main.hbs',
                    dest: 'build/index.html'
                }],
                templateData: 'data/index.json'
            }

main.hbs:

<html>
    <head>
        <title>{{title}}</title>
    </head>
    <body>
    </body>
</html>

and index.json

{
    title : "This is Home!"
}

when i run grunt serveral time , build/index.html would be :

<html>
    <head>
        <title>This is Home!</title>
    </head>
    <body>
    </body>
</html>
<html>
    <head>
        <title>This is Home!</title>
    </head>
    <body>
    </body>
</html>
<html>
    <head>
        <title>This is Home!</title>
    </head>
    <body>
    </body>
</html>

but i think it should be

<html>
    <head>
        <title>This is Home!</title>
    </head>
    <body>
    </body>
</html>

more info :

nodejs --version
v0.10.33

grunt --version
grunt-cli v0.1.13
grunt v0.4.5

cat package.json| grep compile

grunt-compile-handlebars : 2.0.0

@beygi I attempted to slide this in quickly to the appendToFile check, however it ends up breaking some of the tests in bad ways. The simplest thing to do in the mean time is add a clean task that runs before compile-handleabars.

I'll try and get this working still, though.

@patrickkettner thank you :)

👍