Created
June 4, 2011 03:06
-
-
Save masterkain/1007518 to your computer and use it in GitHub Desktop.
Rails 3-1-stable (git) assets pipeline starting point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a manifest file that'll be compiled into application.js and include all the files listed below. | |
// Add new JavaScript/Coffee code in separate files in; this directory, lib/assets/javascripts, or vendor/assets/javascripts | |
// and they'll be included in the compiled file accessible from http://example.com/assets/application.js | |
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | |
// the compiled file. | |
// | |
// WARNING: DO NOT LEAVE ANY BLANK LINES BETWEEN REQUIRES BELOW | |
// | |
// Add a = directive for jquery if you don't want to use the CDN method in layout | |
// require jquery | |
//= require jquery_ujs | |
//= require pjax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "layout"; | |
@import "home"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path('../boot', __FILE__) | |
require "rails/all" | |
# If you have a Gemfile, require the gems listed there, including any gems | |
# you've limited to :test, :development, or :production. | |
Bundler.require(:default, Rails.env) if defined?(Bundler) | |
module MyApp | |
class Application < Rails::Application | |
# Settings in config/environments/* take precedence over those specified here. | |
# Application configuration should go into files in config/initializers | |
# -- all .rb files in that directory are automatically loaded. | |
# Custom directories with classes and modules you want to be autoloadable. | |
config.autoload_paths += %W(#{config.root}/lib) | |
# Only load the plugins named here, in the order given (default is alphabetical). | |
# :all can be used as a placeholder for all plugins not explicitly named. | |
# config.plugins = [ :exception_notification, :ssl_requirement, :all ] | |
# Activate observers that should always be running. | |
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer | |
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. | |
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. | |
# config.time_zone = 'Central Time (US & Canada)' | |
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. | |
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] | |
# config.i18n.default_locale = :de | |
# Configure the default encoding used in templates for Ruby 1.9. | |
config.encoding = "utf-8" | |
# Configure sensitive parameters which will be filtered from the log file. | |
config.filter_parameters += [:password] | |
# Enable the asset pipeline | |
config.assets.enabled = true | |
# Hack because Rails doesn't autoload those paths at the moment for some reason. | |
config.assets.paths << "#{Rails.root}/vendor/assets" << "#{Rails.root}/lib/assets" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JS/CSS are first class citizen, sometimes you need the path for a SWF movie. | |
module ApplicationHelper | |
# Computes the path to a flash movie asset in the public flash directory. | |
# Full paths from the document root will be passed through. | |
# | |
# swf_path("movie") # => "/flash/movie.swf" | |
# swf_path("movie.swf") # => "/flash/movie.swf" | |
# swf_path("my/movie.swf") # => "/flash/my/movie.swf" | |
# swf_path("/flash/movie.swf") # => "/flash/movie.swf" | |
# swf_path("http://www.example.com/flash/movie.swf") # => "http://www.example.com/flash/movie.swf" | |
# | |
# If you have images as application resources this method may conflict with their named routes. | |
# The alias +path_to_image+ is provided to avoid that. Rails uses the alias internally, and | |
# plugin authors are encouraged to do so. | |
def swf_path(source) | |
asset_paths.compute_public_path(source, 'flash', 'swf') | |
end | |
alias_method :path_to_swf, :swf_path # aliased to avoid conflicts with an swf_path named route | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-# | |
-# application.html.haml | |
-# | |
-# Created by kain on 2011-05-30. | |
-# | |
!!! 5 | |
%html{:lang => "en"} | |
%head | |
%meta{:charset => "utf-8"}/ | |
= csrf_meta_tags | |
= favicon_link_tag 'favicon.ico', rel: 'shortcut icon' | |
= favicon_link_tag 'mb-icon.png', rel: 'apple-touch-icon', type: 'image/png' | |
= stylesheet_link_tag :application | |
%title YourTitle | |
%body | |
%header | |
#logo | |
= image_tag('logo.png', :alt => 'YourAlt') | |
%section#global_search | |
= form_tag search_store_path, :method => 'get' do | |
%p | |
= text_field_tag :search, params[:search] | |
= submit_tag "Search", :name => nil | |
%section#user_meta | |
- if user_signed_in? | |
%p Signed in as #{current_user.email}. Not you? | |
= link_to "Sign out", destroy_user_session_path, :method => :delete | |
- else | |
= link_to "Sign up", new_user_registration_path | |
or | |
= link_to "sign in", new_user_session_path | |
#messages | |
%p.notice= notice | |
%p.alert= alert | |
#wrapper | |
%nav | |
= render 'shared/sidebar' | |
%section#main | |
= yield | |
= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/#{Jquery::Rails::JQUERY_VERSION}/jquery.min.js" | |
:coffeescript | |
document.write(unescape(#{URI.escape(javascript_include_tag('jquery')).to_json})) if not jQuery? | |
= javascript_include_tag :application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "http://rubygems.org" | |
# Framework | |
gem "rails", :git => "git://github.com/rails/rails.git", :branch => "3-1-stable" | |
gem "mysql2", :git => "git://github.com/brianmario/mysql2.git" | |
# Asset template engines | |
gem "sass"#, :git => "git://github.com/nex3/sass.git" | |
gem "sass-rails", :git => "git://github.com/rails/sass-rails.git" | |
gem "coffee-script"#, :git => "git://github.com/jashkenas/coffee-script.git" | |
gem "uglifier", :git => "git://github.com/lautis/uglifier.git" | |
gem "jquery-rails", :git => "git://github.com/rails/jquery-rails.git" | |
gem "pjax_rails", :git => "git://github.com/rails/pjax_rails.git" | |
gem "compass", :git => "git://github.com/chriseppstein/compass.git", :branch => "rails31" | |
gem "coffee-filter", :git => "git://github.com/paulnicholson/coffee-filter.git" | |
gem "haml", :git => "git://github.com/nex3/haml.git" | |
gem "tilt", :git => "git://github.com/rtomayko/tilt.git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jwplayer manifest file. | |
// create a jwplayer.js in the same directory. | |
// | |
//= require ./jwplayer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you shouldn't need require_self because it's an unecessary hack, or depend_on because the sass integration should take care of that.