Advertisement
Guest User

grunt-bower issue post 0.15.0

a guest
Oct 23rd, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // tasks/config/bower.js -- I added this
  2. module.exports = function(grunt) {
  3.     grunt.config.set('bower', {
  4.         dev: {
  5.             dest: '.tmp/public',
  6.             js_dest: '.tmp/public/js',
  7.             css_dest: '.tmp/public/styles'
  8.         }
  9.     });
  10.  
  11.     grunt.loadNpmTasks('grunt-bower');
  12. };
  13.  
  14. // tasks/register/compileAssets.js -- Then modified this
  15. module.exports = function (grunt) {
  16.     grunt.registerTask('compileAssets', [
  17.         'clean:dev',
  18.             'bower:dev',
  19.         'jst:dev',
  20.         'less:dev',
  21.         'copy:dev',
  22.         'coffee:dev'
  23.     ]);
  24. };
  25.  
  26. // Gruntfile.js -- this is not altered from what SailsJS generated
  27. /**
  28.  * Gruntfile
  29.  *
  30.  * This Node script is executed when you run `grunt` or `sails lift`.
  31.  * It's purpose is to load the Grunt tasks in your project's `tasks`
  32.  * folder, and allow you to add and remove tasks as you see fit.
  33.  * For more information on how this works, check out the `README.md`
  34.  * file that was generated in your `tasks` folder.
  35.  *
  36.  * WARNING:
  37.  * Unless you know what you're doing, you shouldn't change this file.
  38.  * Check out the `tasks` directory instead.
  39.  */
  40.  
  41. module.exports = function(grunt) {
  42.  
  43.  
  44.     // Load the include-all library in order to require all of our grunt
  45.     // configurations and task registrations dynamically.
  46.     var includeAll;
  47.     try {
  48.         includeAll = require('include-all');
  49.     } catch (e0) {
  50.         try {
  51.             includeAll = require('sails/node_modules/include-all');
  52.         }
  53.         catch(e1) {
  54.             console.error('Could not find `include-all` module.');
  55.             console.error('Skipping grunt tasks...');
  56.             console.error('To fix this, please run:');
  57.             console.error('npm install include-all --save`');
  58.             console.error();
  59.  
  60.             grunt.registerTask('default', []);
  61.             return;
  62.         }
  63.     }
  64.  
  65.  
  66.     /**
  67.      * Loads Grunt configuration modules from the specified
  68.      * relative path. These modules should export a function
  69.      * that, when run, should either load/configure or register
  70.      * a Grunt task.
  71.      */
  72.     function loadTasks(relPath) {
  73.         return includeAll({
  74.             dirname: require('path').resolve(__dirname, relPath),
  75.             filter: /(.+)\.js$/
  76.         }) || {};
  77.     }
  78.  
  79.     /**
  80.      * Invokes the function from a Grunt configuration module with
  81.      * a single argument - the `grunt` object.
  82.      */
  83.     function invokeConfigFn(tasks) {
  84.         for (var taskName in tasks) {
  85.             if (tasks.hasOwnProperty(taskName)) {
  86.                 tasks[taskName](grunt);
  87.             }
  88.         }
  89.     }
  90.  
  91.  
  92.  
  93.  
  94.     // Load task functions
  95.     var taskConfigurations = loadTasks('./tasks/config'),
  96.         registerDefinitions = loadTasks('./tasks/register');
  97.  
  98.     // (ensure that a default task exists)
  99.     if (!registerDefinitions.default) {
  100.         registerDefinitions.default = function (grunt) { grunt.registerTask('default', []); };
  101.     }
  102.  
  103.     // Run task functions to configure Grunt.
  104.     invokeConfigFn(taskConfigurations);
  105.     invokeConfigFn(registerDefinitions);
  106.  
  107. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement