Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] config #62

Open
marocas opened this issue Feb 6, 2016 · 1 comment
Open

[TASK] config #62

marocas opened this issue Feb 6, 2016 · 1 comment

Comments

@marocas
Copy link

marocas commented Feb 6, 2016

Hello, im generating my html, but my utilities data.json are not getting passed.
I have installed the latest version, gch, but even so, if i have more than one data.json, gch aint getting the info.

here is my config:

"use strict";

module.exports = {
  main: {
        files: [{
            expand:     true,
            cwd:        "<%= cfg.root %><%= cfg.src.html %>templates/",
            src:        "*.hbs",
            dest:       "<%= cfg.root %><%= cfg.dest.html %>",
            ext:        ".html"
        }],

        preHTML:        "<%= cfg.root %><%= cfg.src.utils %>globals/head.html",
        postHTML:       "<%= cfg.root %><%= cfg.src.utils %>globals/foot.html",

        partials:       "<%= cfg.root %><%= cfg.src.html %>**/*.hbs",

        templateData:   ["html/_patterns/utilities/data/*.json"],
        helpers:        "<%= cfg.root %><%= cfg.src.utils %>helpers/**/*.js"
    }
};

Am i missing something here?

BTW, how can i get from a json file, the name of the first node?
I want to get the "icon-adv" name?

{
    "icon-adv": {
        "x": 86,
        "y": 82,
        "width": 43,
        "height": 39,
        "source_image": "html/_images/icons/icon-adv.png",
        "image": "../../../images/icons.png",
        "total_width": 224,
        "total_height": 186,
        "escaped_image": "../../../images/icons.png",
        "offset_x": -86,
        "offset_y": -82,
        "px": {
            "x": "86px",
            "y": "82px",
            "offset_x": "-86px",
            "offset_y": "-82px",
            "height": "39px",
            "width": "43px",
            "total_height": "186px",
            "total_width": "224px"
        }
    },
}

Best regards, Mário Silva.

@mikemellor11
Copy link

#60 I believe it's related to this problem, at the minute the path your specifying in templateData is being ignored and it's trying to find the json files in your "<%= cfg.root %><%= cfg.src.html %>templates/" handlebars folder.

If you run the task with verbose you'll see it failing to find the json - grunt compile-handlebars --verbose

Also as icon-adv is a key i don't believe you can actually get the value of the key itself, can you add a property to icon-adv like so:

{
    "icon-adv": {
        "name": "icon-adv",
        "x": 86,
        "y": 82,
        "width": 43,
        "height": 39,
        "source_image": "html/_images/icons/icon-adv.png",
        "image": "../../../images/icons.png",
        "total_width": 224,
        "total_height": 186,
        "escaped_image": "../../../images/icons.png",
        "offset_x": -86,
        "offset_y": -82,
        "px": {
            "x": "86px",
            "y": "82px",
            "offset_x": "-86px",
            "offset_y": "-82px",
            "height": "39px",
            "width": "43px",
            "total_height": "186px",
            "total_width": "224px"
        }
    },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants