当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: