Downloads in verschiedenen Formaten:
Resourcen:
Gemfile
[ruby]
gem "rails", "3.1.0"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem ’sass-rails‘, " ~> 3.1.0"
gem ‚coffee-rails‘, "~> 3.1.0"
gem ‚uglifier‘
end
gem ‚jquery-rails‘
[/ruby]
config/application.rb
[ruby]
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
# …
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = ‚1.0‘
[/ruby]
config/environments/development.rb
[ruby]
# comment out this line:
# config.action_view.debug_rjs = true
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
[/ruby]
config/environments/test.rb
[ruby]
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
config.assets.allow_debugging = true
[/ruby]
config/environments/production.rb
[ruby]
# Compress JavaScripts and CSS
config.assets.compress = true
# Don’t fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
[/ruby]
views/layouts/application.html.erb
[html]
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
[/html]
.gitignore
[bash]
.sass-cache/
[/bash]
app/assets/javascripts/application.js
[javascript]
//= require jquery
//= require jquery_ujs
//= require_self
//= require_tree .
[/javascript]
app/assets/stylesheets/application.css
[css]
/*
*= require_self
*= require_tree .
*/
[/css]