Using index files with the Rails Asset Pipeline

I want to include one theme folder in my app https://github.com/usmanhalalit/charisma .

Like this doc http://guides.rubyonrails.org/asset_pipeline.html#asset-organization , I clone the theme folder in app / assets / charisma and put

config.assets.paths <Rails.root.join ("application", "assets", "charisma")

to my app config.

Then I create index.js and index.css for app / assets / charisma /:

/*
 *= require_tree .
*/


//= require_tree .

      

Then I add //= require charisma

to my application.js, it gave an error: couldn't find file 'charisma'

when my application started

+3


source to share


2 answers


I guess you shouldn't be adding a new folder in the asset path. Just clone the repository to vendor/assets/charisma

or lib/assets/charisma

and create your index files.



+2


source


I finally figured out from this. In fact, I think there is a bug in the docs at http://guides.rubyonrails.org/asset_pipeline.html#using-index-files . The index files should be named library_name.css instead of index.css (in your case create /vendor/assets/charisma/charisma.css), then in your application.css you can call // = require charisma.



+1


source







All Articles