linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

lineman config --process does not process object keys #324

Open tandrewnichols opened 9 years ago

tandrewnichols commented 9 years ago

The --process flag on the lineman config command is a great tool, but it only expands values in the config, but leaves keys untouched, so you end up with output that looks like:

  "<%= files.less.generated %>": "app/css/main.less"

Seems like --process should do the "dest" key too.

searls commented 9 years ago

Yeah, I'm not entirely sure how it would interpolate keys. Maybe look into a PR?

On Wed, Sep 24, 2014 at 10:26 AM, Andrew Nichols notifications@github.com wrote:

The --process flag on the lineman config command is a great tool, but it only expands values in the config, but leaves keys untouched, so you end up with output that looks like:

  "<%= files.less.generated %>": "app/css/main.less"

Seems like --process should do the "dest" key too.

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/324

jasonkarns commented 9 years ago

Interesting. I assume we're using grunt.config.process under the covers? http://gruntjs.com/api/grunt.config#grunt.config.process

If so, does grunt.contrib.process not already expand keys itself?

tandrewnichols commented 9 years ago

If you're using underscore or lodash templating (and I assume you are), seems like you should be able to do the entire config object as a json string, rather than each key individually.

But this might be naive; I have not looked at all at how that lineman config is built. But presumably, once you compile the object, you could do something like:

console.log(_.template(JSON.stringify(configObj, null, 2), filesObj));

Again, that's probably oversimplified, but that's probably roughly what I'd try for.

But per @jasonkarns point, if you're using something else, maybe this doesn't work. Doesn't seem like it would be hard to do it yourself, though.

davemo commented 9 years ago

I started working on something similar here: https://github.com/linemanjs/lineman/commit/cc4899a8931dcad83647549b4ce95f86593f7e06 but never ended up going further with it.