gruntjs / grunt-contrib-pug

Compile Pug templates.
http://gruntjs.com/
MIT License
328 stars 77 forks source link

Unable to pass data to .pug file during compilation #166

Closed jagzviruz closed 8 years ago

jagzviruz commented 8 years ago

I have a .pug file like below

img(src="#{cdnImg}/name.svg")
img(src="#{cdn}/name.svg")

and a gruntfile like below.

module.exports = function(grunt) {
    grunt.initConfig({
            pug: {
                dev: {
                    options: {
                        data: {
                            cdn: "/img",
                            cdnImg: "/images"
                        }
                    },
                    files: {
                        'test.html': 'test.pug'
                    }
                }
            }
    });
};
grunt.loadNpmTasks('grunt-contrib-pug');
grunt.registerTask('default', ['pug:dev']);

When I execute the default task, I get a html generated as below <img src="#{cdnImg}/name.svg"/><img src="#{cdn}/name.svg"/>

As you see the variables did not get replaced. Is this a bug, or am I doing something wrong ?

shinnn commented 8 years ago

This is not an issue with this plugin, but with Pug. https://github.com/pugjs/pug/issues