Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Set Resources Path

I'm working on rails app and want to keep my javascript as seperated as possible from my backend application logic. I'm planning on using the assets to build an app on top of phonegap later. For my dependencies (javascripts) I'm using bower. I set my bower packages to install at vendor/javascripts but was wondering how I could expose this path to my requirejs-rails calls?

Essentially, what I want to be able to do is require these files in my require-main.js file and have access to them from the rails asset pipeline.

So my code looks something like this

vendor/javascripts/jquery/jquery.min.js //want to include this

requirejs.config {

    paths: {

            // following file is located in the vendor/javascripts folder...
        jquery: "javascripts/jquery/jquery.min.js"
    }
}

require ["jquery"], ($) ->


    console.log $

Has anyone gotten bower and rails to play nicely together? Thanks

like image 445
JonMorehouse Avatar asked Dec 17 '25 18:12

JonMorehouse


1 Answers

What you can do is: in the root folder create a file called ".bowerrc" and the content can be the path:

e.g:

{
  "directory" : "vendor/plugins"
}

after that you should run bower install again

like image 137
alexlopez Avatar answered Dec 20 '25 09:12

alexlopez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!