Reputation: 207
grunt.config('sass', {
options: {
sourceMap: true
},
dist: {
options: {
outputStyle: 'compact'
},
files: {
'/css/site.css': 'main/scss/site.scss',
'/css/template.home.css': 'main/scss/templates/home.scss'
'/css/template.contact.css': 'main/scss/templates/contact.scss'
'/css/template.something.css': 'main/scss/templates/something.scss'
}
}
});
is there is any way to handle this part nicely ( Thinking about a pattern but I' not sure about the possibility )
'/css/template.home.css': 'main/scss/templates/home.scss'
'/css/template.contact.css': 'main/scss/templates/contact.scss'
'/css/template.something.css': 'main/scss/templates/something.scss'
Upvotes: 0
Views: 51
Reputation: 8332
If you declare the config as a JS object you could do it like this:
var cfg = {
options: {
sourceMap: true
},
dist: {
options: {
outputStyle: 'compact'
},
files: {
'/css/site.css': 'main/scss/site.scss',
'/css/template.home.css': 'main/scss/templates/home.scss',
'/css/template.contact.css': 'main/scss/templates/contact.scss',
'/css/template.something.css': 'main/scss/templates/something.scss'
}
}
},
grunt = {
config: function() {
document.write('<br/><strong>grunt config set</string><br/>');
}
};
document.write('<br/>"files" before new config:<br/><br/>');
for (var property in cfg.dist.files) {
if (cfg.dist.files.hasOwnProperty(property)) {
document.write(property + ' = ' + cfg.dist.files[property] + '<br/>');
}
}
document.write('<br/>"files" after added config:<br/><br/>');
cfg.dist.files['/css/what ever...'] = 'the/latest/path';
for (var property in cfg.dist.files) {
if (cfg.dist.files.hasOwnProperty(property)) {
document.write(property + ' = ' + cfg.dist.files[property] + '<br/>');
}
}
grunt.config('sass', cfg);
Note the
cfg.dist.files['/css/what ever...'] = 'the/latest/path';
That's where the additional config is added.
Upvotes: 2