Is it possible to read the JSON file of child themes and variables related to each of them and create a dynamically generated build process through grunt.js?
In particular, I have a standard grunt.initConfig()for each JSON object in an external file themes.json, I want to repeat the entire assembly process of the main one grunt.initConfig(), but I need to pass variables (not always the same) through meta associated with each child theme to the assembly process.
I spent a lot of time on this, and I'm starting to think that I grunt.jsjust cannot host the build process I'm looking for. I thought that by creating a mirror hierarchy in a regular meta-value like this
module.exports = function(grunt) {
grunt.initConfig({
pkg: '<json:package.json>',
_themes: '<json:themes.json>',
recess : 'foo',
concat : 'bar',
mincss : 'baz
}
and then inside themes.jsonagain mirrors this structure, but is called into a root configuration file like this
{
"themFoo" : {
"_meta_val_1" : "x",
"_meta_val_2" : "y",
"_meta_val_3" : "z",
"recess" : "<%= recess %>",
"concat" : "<%= concat %>",
"mincss" : "<%= min %>"
}
So that I can get the default configuration and just fill in the blanks with template variables, but this doesn't seem to work.
source
share