刚刚和朋友聊起来相关的东西,赶紧纪录下来
主要就是打开了asset pipeline和用了html5
1新建Rails 项目,有home controller,index action 和root路由并且删除public下index.html和views/layouts/application.html.erb
2添加或修改以下Gemfile
3运行
4 创建如下文件 [quote]/config/initializers/sass.rb[/quote]
5 执行
6 执行
主要就是打开了asset pipeline和用了html5
1新建Rails 项目,有home controller,index action 和root路由并且删除public下index.html和views/layouts/application.html.erb
2添加或修改以下Gemfile
gem 'rails', '~> 3.1.0'
gem 'unicorn'
group :assets do
gem 'compass', "~> 0.12.alpha.0"
gem 'sass-rails', "~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
gem 'compass-html5', :git => 'https://github.com/sporkd/compass-html5.git'
gem 'html5-rails', :git => "https://github.com/sporkd/html5-rails.git"
end
#application.rb
config.assets.precompile += %w( polyfills.js )
3运行
rails g html5:install
生成 [quote]/config/compass.rb[/quote] 文件
4 创建如下文件 [quote]/config/initializers/sass.rb[/quote]
Rails.configuration.sass.tap do |config|
config.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
end
5 执行
RAILS_ENV=production bundle exec rake assets:precompile
6 执行
unicorn -E production
或
rails s -e production