Bower integration with your Rails 4 app

First take a look to this post making a basic NodeJS installation on Ubuntu. You will need npm and bower installed.

If you want more details about this process take a look to this post.

Configure Bower to place libraries in our vendor directory’.bowerrc':

{
 "directory": "vendor/assets/components"
}

Asset pipeline should know where to locate these libraries in order to process them. so write in your ‘config/application.rb':

config.assets.paths << Rails.root.join('vendor', 'assets', 'components')

With `bower init` you would create ‘bower.json’ file which should have the following aspect:

{
  name: 'BowerAndRails',
  version: '0.0.1',
  authors: [
    'Syl <nop@nope.com>'
  ],
  description: 'Tutorial about Bower and Rails',
  license: 'MIT',
  homepage: 'http://mycoolhomepage.com',
  ignore: [
    '**/.*',
    'node_modules',
    'bower_components',
    'test',
    'tests'
  ],
  "dependencies": {
    "intl-tel-input": "~6.0.6"
  }
}

With the command `bower install` all dependencies will be installed at ‘vendor/assets/components’.

After that you can import the files in your assets. At ‘application.js':

//= require intl-tel-input
//= require intl-tel-input/lib/libphonenumber/build/utils

At ‘application.sass':

@import intl-tel-input/src/css/intlTelInput
.iti-flag
  background-image: url('intl-tel-input/build/img/flags.png')

On `rails s` assets will be taken from bower components.

13 thoughts on “Bower integration with your Rails 4 app

  1. 逆向直销,震撼来袭:

    优势①:逆向网赚,真正实现就算什么不干都赚钱
    优势②:十级提成,下线年年续费,上线年年收钱
    优势③:静态分红,每日签到就有钱,封顶一百元
    优势④:百万资源,每日更新,一键转存无限下载
    优势⑤:强大网站,八个栏目,无限发布产品广告

    免费注册地址:

    http://www.629494567.9489988.com/

  2. Excellent post. I used too be checking continuously this blog
    and I’m inspired! Extremely useful info specially the final part
    :) I handle such info a lot. I was seeking this certain information for a long time.
    Thanks and best of luck.

  3. Greetings from Idaho! I’m bored at work so I decided
    to browse your website on my iphone during lunch break. I
    love the information you present here and can’t wait
    to take a look when I get home. I’m amazed at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyhow, wonderful blog!

  4. A good tip to use when thinking about downloading music is
    to make sure you aren’t tying up your internet connection with other things.
    More music is being consumed on more devices by more listeners than ever before in history.
    My brother was a drummer and my sister was a pianist
    and a singer.

  5. A simple change in a security’s market value is not a loss of principal just as certainly as a change in the market value of your home is not evidence of termite damage. This report will demonstrate these kinds of capabilities and let by yourself in direction of generate world wide web reproduction which provides in just significant product sales.He is hitting . Cheap NFL Jerseys China . The bronze medalist in the Juvenile Champ final last season has yet to win a 5F race and despite another adva

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>