Skip to content

Templates fail to compile correctly #8

@andreas-marschke

Description

@andreas-marschke

Trying to output results in a JSON format fails as the starting curly brace { is picked up by the templating in the task eg.:

{
          filesize: {
                        default: {
                                files: [{
                                        expand: true,
                                        cwd: "build",
                                        src: "./**/*.js.*",
                                        ext: ".js*",
                                        extDot: "first"
                                }],
                                options: {
                                        output: {
                                                path: "results/filesizes.json",
                                                format: "\{\"name\": \"{filename}\" \}"        
                                                append: true
                                        }
                                }
                        }
                }
}

This example task configuration fails as the first curly brace is interpreted as a template var.
I'd suggest using grunt.template and removing the templating code all together.

New usage example for format would be:

  format: "<%= filename %>,<%= kb%>,<%= now %>"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions