Search code examples
ruby-on-railsrails-enginestwitter-bootstrap-rails

Using twitter bootstrap rails in an engine


I'm currently trying to develop a rails engine and i would like to use twitter boostrap rails in this engine. I've already added the gem to my dependencies in the gemspec file but there's rails generators that need to be executed to run properly . How could i run the twitter boostrap generators automatically when the engine is installed ?

thanks


Solution

  • In your own generator, you can execute a command line like this :

    ...
    `rails g bootstrap:install`
    ...
    

    Don't forget the `.

    Not sure but you can also try this :

    generator = Bootstrap::Generators::InstallGenerator.new
    generator.add_assets
    generator.add_bootstrap
    generator.cleanup_legacy
    

    I think the better way is this :

    Rails::Generators.invoke "bootstrap:install", [], :behavior => :invoke, :destination_root => Rails.root