yeoman / grunt-bower-requirejs

[DEPRECATED] Grunt task - Automagically wire-up installed Bower components into your RequireJS config
198 stars 24 forks source link

RequireJS config file not created #24

Closed amiceli closed 10 years ago

amiceli commented 10 years ago

When I run this command, the configuration file is not created :

grunt bower:target --config

My Grunt file :

target: {
    rjsConfig: 'config.js',
    options: {
        baseUrl: './'
    }
}

thanks for your help.

bezoerb commented 10 years ago

@amiceli works as expected in local test. Creates empty config in fresh project with no bower components installed. Can you give some more infos about your environment (OS, Node version, Gruntfile.js, package.json) (maybe as gist)

amiceli commented 10 years ago

I'm on windows 7 64 bits. node v0.10.25 npm v1.4.3 grunt-cli v0.1.13 grunt v0.4.4

This is my Gruntfile

module.exports = function(grunt) {
    grunt.initConfig({
        bower: {
             target: {
                  rjsConfig: 'config.js',
                  options: {
                      baseUrl: './'
                  }
            }
        }
     });
    grunt.loadNpmTasks('grunt-bower-requirejs');

    grunt.registerTask('default', [ 'bower:target'])
}

When i run grunt bower:target --config my bower components are correctly installed but the config.js file is empty.

bezoerb commented 10 years ago

I need to check this on windows 7 later this day

bezoerb commented 10 years ago

Hi @amiceli, even on windows 7 my tests run as expected. No issues though. But i'm a bit confused that your bower components get installed when running grunt bower:target. This module does not install bower components. Sure you've got the right package installed?

amiceli commented 10 years ago

I maybe found the problem, i've installed your module and grunt-bower-task module. This module install bower packages smartly.

In fact i want to generate requireJS config file with packages installed from grunt-bower-task

bezoerb commented 10 years ago

There are naming conflicts with those two module because they both register the bower grunt task. Try using this task instead of grunt-bower-task. You should uninstall grunt-bower-task to prevent conflicts: npm uninstall --save-dev grunt-bower-task

  grunt.registerTask('bower-install', function () {
    var done = this.async();
    grunt.util.spawn({
      cmd: 'bower',
      args: ['install'],
      opts: {
        stdio: 'inherit'
      }
    }, function (error, result) {
      if (error) {
        grunt.fail.fatal(result.stdout);
      }
      grunt.log.writeln(result.stdout);
      done();
    });
  });
amiceli commented 10 years ago

Thanks you, it works perfectly !

amiceli commented 10 years ago

Just a question, there is a solution for use both modules ?

bezoerb commented 10 years ago

i think not. @robdodson @sindresorhus do you know something about a workaround to use both modules together?

robdodson commented 10 years ago

Not off the top of my head. For the past few months I've thought it might be a good idea to change the grunt task name to bowerRjs or something like that since stealing the bower name is kind of greedy on our part.