GithubHelp home page GithubHelp logo

bower-rails's Introduction

bower-rails

rake tasks for bower on rails. Dependency file is bower.json in Rails root dir.

Requirements

Install

in Gemfile

	gem "bower-rails", "~> 0.4.0"

Initialize

To add an empty bower.json file to the project root.

	rails g bower_rails:initialize

##JSON configuration

The bower.json file is two seperate bower component.js files. Defining a package in lib and vendor will install those packages to the corresponding directories.

example bower.json file

{
   "lib": {
    "name": "bower-rails generated lib assets",
    "dependencies": {
      "threex"      : "[email protected]:rharriso/threex.git",
      "gsvpano.js"  : "https://github.com/rharriso/GSVPano.js/blob/master/src/GSVPano.js"
    }
  },
  "vendor": {
    "name": "bower-rails generated vendor assets",
    "dependencies": {
      "three.js"    : "https://raw.github.com/mrdoob/three.js/master/build/three.js"
    }
  }
}

Available commands

  rake bower:install #install js components
  rake bower:update  #update js components

##Ruby DSL configuration

The Ruby DSL configuration is a Jsfile with DSL syntax similar to Bundler.

Example Jsfile

By default assets are put to ./vendor/assets/bower_components directory:

# Puts to ./vendor/assets/bower_components
js "backbone"
js "moment"

But the default value can be overridden by assets_path method:

assets_path "assets/my_javascripts"

# Puts to ./vendor/assets/my_javascripts/bower_components
js "backbone"
js "moment"

And finally, the assets_path method can be overridden by an option in a group call:

assets_path "assets/javascript"

# Puts files under ./vendor/assets/js/bower_components
group :vendor, :assets_path => "assets/js"  do
  js "jquery"            # Assummes it's latests
  js "backbone", "1.2"
end

# Puts files under ./lib/assets/javascript/bower_components
group :lib do
  js "jquery"
  js "backbone", "1.2"
end

NOTE: All the assets should be stored in /assets subdirectory so putting it under ./vendor/js directory is unavailable

Available commands with a Jsfile

  rake bower:dsl:install #install js components
  rake bower:dsl:update  #update js components

bower-rails's People

Contributors

codeodor avatar fddayan avatar fny avatar fredjean avatar kenips avatar klacointe avatar mattr- avatar rharriso avatar sergeykishenin avatar tikitdo avatar tohae avatar tylerflint avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.