firstandthird / load-grunt-config

Grunt plugin that lets you break up your Gruntfile config by task
firstandthird.github.io/load-grunt-config/
MIT License
374 stars 64 forks source link

Can't use <%= package.var %> in data config #46

Closed tigerclaw-az closed 10 years ago

tigerclaw-az commented 10 years ago

I'm trying to use the "data" property for adding additional configuration variables that can be used in the task files:

Gruntfile.js

// load grunt config
    require('load-grunt-config')(grunt, {
        data: {
            appPath: "<%= package.appPath %>",
            cssPath: "<%= package.appPath %>/css",
            jsPath: "<%= package.appPath %>/js",
            tplPath: "<%= package.appPath %>/templates"
        }
    });

csslint.js

files: ["<%= cssPath %>/jquery-ui/themes/itracs/jquery-ui.css", "<%= cssPath %>/main.css", "<%= cssPath %>/cpim/*.css"],
    options: {
        csslintrc: "<%= cssPath %>/.csslintrc"
}

When I run grunt I get the following error:

Running "csslint:files" (csslint) task
Warning: An error occurred while processing a template (Cannot read property 'appPath' of undefined). Use --force to continue.
TypeError: An error occurred while processing a template (Cannot read property 'appPath' of undefined).
    at eval (/lodash/template/source[2]:6:22)
    at Function.template (/Users/ewaibel/git-repos/webui/node_modules/grunt/node_modules/lodash/lodash.js:3879:14)
    at Object.template.process (/Users/ewaibel/git-repos/webui/node_modules/grunt/lib/grunt/template.js:75:27)
    at /Users/ewaibel/git-repos/webui/node_modules/grunt/lib/grunt/config.js:75:27
    at recurse (/Users/ewaibel/git-repos/webui/node_modules/grunt/lib/grunt/util.js:116:12)
    at /Users/ewaibel/git-repos/webui/node_modules/grunt/lib/grunt/util.js:105:14
    at Array.map (native)
    at Object.recurse (/Users/ewaibel/git-repos/webui/node_modules/grunt/lib/grunt/util.js:104:18)
    at Function.config.process (/Users/ewaibel/git-repos/webui/node_modules/grunt/lib/grunt/config.js:61:21)
    at Function.config.get (/Users/ewaibel/git-repos/webui/node_modules/grunt/lib/grunt/config.js:55:17)
FrankFang commented 10 years ago

https://github.com/firstandthird/load-grunt-config/issues/36#issuecomment-36532908

jgallen23 commented 10 years ago

@ejwaibel are you using 0.8.0 beta or 0.7.x?

tigerclaw-az commented 10 years ago

@jgallen23 Sorry, I'm using the latest 0.8.0 beta

jgallen23 commented 10 years ago

k. I'll take a look

tigerclaw-az commented 10 years ago

Thanks!

jgallen23 commented 10 years ago

will be fixed in the next beta. thanks for reporting!

tigerclaw-az commented 10 years ago

Sweet thanks! When do you think that will get pushed out?

jgallen23 commented 10 years ago

just pushed out as 0.8.0-beta.2