简体   繁体   中英

How to add my Js/Css files to a Rails Application?

I have a project which i was building in Sublime, with normal folders for Css and Js, where i have my scripts. When i create the project in Rails i only paste the content of body in the index.html.erb and my css and js files in the app/assets/stylesheets or app/assets/javascript, css works fine, except images console shows "Not found" (i dont know where to place my img folder to be found) and shows me that must load bootstrap first but i paste it all in my javascript folder.

Any help?

Thank you.

Images can be places in app/assets/images and then you can use them in erb, css/scss, and js/coffee files if you append .erb to the filename you can use the asset helpers such as asset_url and so on. Also if you are using the sass-rails gem you can use the asset-url helper without needing to add the erb extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM