Skip to content

Instantly share code, notes, and snippets.

@matmar10
Created May 15, 2017 09:15
Show Gist options
  • Save matmar10/1bc359d93286a8b4bdc50aae77952c94 to your computer and use it in GitHub Desktop.
Save matmar10/1bc359d93286a8b4bdc50aae77952c94 to your computer and use it in GitHub Desktop.
Update embark.json with bower.json dependencies
const wiredep = require('wiredep');
module.exports = function initGrunt(grunt) {
grunt.initConfig({
embark: grunt.file.readJSON('embark.json'),
});
grunt.registerTask('addDeps', 'Adds JS dependencies to embark config', function () {
const deps = wiredep();
const embark = grunt.config('embark');
grunt.verbose.writeln('CSS deps are:', deps.css);
embark.app['css/app.css'] = deps.css || [];
embark.app['css/app.css'].push('app/css/**');
grunt.verbose.writeln('JS deps are:', deps.js);
embark.app['js/app.js'] = deps.js || [];
embark.app['js/app.js'].push('embark.js');
embark.app['js/app.js'].push('app/js/**');
grunt.file.write('embark.json', JSON.stringify(embark, null, 2));
grunt.log.ok('Updated CSS + JS deps in embark.json');
});
};
@matmar10
Copy link
Author

Simple Grunt script to update embark.json based on dependencies in bower.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment