Skip to content

Instantly share code, notes, and snippets.

@axiak
Created April 20, 2012 21:02
Show Gist options
  • Save axiak/2431873 to your computer and use it in GitHub Desktop.
Save axiak/2431873 to your computer and use it in GitHub Desktop.
x.js
var _ = require('underscore');
config = {
'compiled_cache_dir': '../css/tmp',
'processors': {
'js': 'java -jar YUICompressor.jar {input}',
'coffee': ['coffee -c {input} {output}', 'js'],
'less': ['lessc', 'css']
},
'combined': {
'c.carrier.js': [
'portlets/carrier/profile.js',
'portlets/carrier/a.profile.js'
],
'other_file.js': [
'portlets/carrier/profile.js'
],
'c.carrier.css': [
'portlets/carrier/profile.css'
]
},
'css_base_dir': './public/css',
'js_base_dir': './public/js',
'global_js_filename': 'c.global.js',
'global_css_filename': 'c.global.css'
};
result = _.reduce(_.keys(config.combined || {}),
function (memo, combined_file) {
return _.reduce(config.combined[combined_file], function (inner_memo, current_file) {
if (inner_memo[current_file] === undefined) {
inner_memo[current_file] = [];
}
inner_memo[current_file].push(combined_file);
return inner_memo;
},
memo);
},
{});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment