[英]Integrate bootstrap-theme into Ruby on Rails project
我買了一個bootstrap主題,
我想知道如何在一個好的實踐中將它集成到我的Rails項目中
我應該將其Javascript
和css
轉換為coffescript
和scss
如果是這樣,將這些文件放入Rails項目中的相應文件夾時會起作用,對嗎?
我的項目基於Rails 4。
這是我的項目結構
├── app
│ ├── assets
│ ├── controllers
│ ├── helpers
│ ├── mailers
│ ├── models
│ └── views
├── bin
│ ├── bundle
│ ├── rails
│ └── rake
├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ ├── initializers
│ ├── locales
│ └── routes.rb
├── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── favicon.ico
│ └── robots.txt
這是主題的文件夾結構
它存儲css, javascript, fonts, images
├── css
│ ├── animate.min.css
│ ├── bootstrap.css
│ ├── bootstrap.min.css
│ ├── font-awesome.min.css
│ ├── prettyPhoto.css
│ ├── rs-settings-ie8.css
│ ├── rs-settings.css
│ └── style.css
├── fonts
│ ├── FontAwesome.otf
│ ├── fontawesome-webfont.eot
│ ├── fontawesome-webfont.svg
│ ├── fontawesome-webfont.ttf
│ └── fontawesome-webfont.woff
├── img [23 entries exceeds filelimit, not opening dir]
├── index.html
├── js
│ ├── bootstrap.js
│ ├── bootstrap.min.js
│ ├── custom.js
│ ├── gmaps.js
│ ├── html5shiv.js
│ ├── jquery.arbitrary-anchor.js
│ ├── jquery.js
│ ├── jquery.knob.js
│ ├── jquery.prettyPhoto.js
│ ├── jquery.themepunch.plugins.min.js
│ ├── jquery.themepunch.revolution.min.js
│ ├── respond.min.js
│ └── waypoints.min.js
└── rs-assets [36 entries exceeds filelimit, not opening dir]
我想我知道一些方法可以做一個好的練習:
'四人幫和復合模式' - 在單一的整體寶石中構建你的bootstrap主題。
使用清單文件來解析路徑。
嘗試第二種解決方案:
將bootstrap-theme文件夾放入/ app / assets目錄。
添加到“/ bootstrap-theme / js”文件夾新文件, application.js包含內容:
//= require_tree .
添加到“/ bootstrap-theme / css”文件夾新文件, application.css包含內容:
/* *= require_tree . */
包含在/app/assets/javascripts/application.js中:
//= require ../bootstrap-theme/js
包含在/app/assets/stylesheets/application.css中:
//= require ../bootstrap-theme/css
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.