调用bootstrap css框架时,将bootstrap文件夹放入 vendor/assets/下
bootstrap文件结构如下:
[[email protected] demo]$ ls vendor/assets/bootstrap/
css img js
[[email protected] demo]$ ls vendor/assets/bootstrap/css/
bootstrap.css bootstrap.min.css bootstrap-responsive.css bootstrap-responsive.min.css
[[email protected] demo]$ ls vendor/assets/bootstrap/js/
[[email protected] demo]$ ls vendor/assets/bootstrap/img/
glyphicons-halflings.png glyphicons-halflings-white.pngbootstrap.js bootstrap.min.js
为了成功预编译css 下 .css 文件 和 js下 .js 文件,需要如下操作:
1、在 config/environments/production.rb 下修改配置, 如:
增加 css/*.css js/*.js 预编译路径
如: config.assets.precompile += %W(login.css 960.css query.css user_accounts.css jquery-ui-1.8.20.custom.css css/*.css js/*.js)
2、 rake assets:precompile
就会发现,在public/assets/css下 和 public/assets/js 下 已经成功生成相应的预编译文件
如:
[[email protected] demo]$ ls public/assets/css/ | grep boot*
bootstrap-78a0f6272d122980f8619d083a59ff47.css
bootstrap-78a0f6272d122980f8619d083a59ff47.css.gz
bootstrap.css
bootstrap.css.gz
bootstrap.min.css
bootstrap.min.css.gz
bootstrap.min-f5df4747a36eb74007d0c4ba70bda825.css
bootstrap.min-f5df4747a36eb74007d0c4ba70bda825.css.gz
bootstrap-responsive-60ee06597d41447ace662cae84bcf41f.css
bootstrap-responsive-60ee06597d41447ace662cae84bcf41f.css.gz
bootstrap-responsive.css
bootstrap-responsive.css.gz
bootstrap-responsive.min-9c6d6ce0e50b323d2e2f199373c69ae0.css
bootstrap-responsive.min-9c6d6ce0e50b323d2e2f199373c69ae0.css.gz
bootstrap-responsive.min.css
bootstrap-responsive.min.css.gz