sprockets-rails-2.3.2/0000755000004100000410000000000012555334222014676 5ustar www-datawww-datasprockets-rails-2.3.2/lib/0000755000004100000410000000000012555334222015444 5ustar www-datawww-datasprockets-rails-2.3.2/lib/sprockets/0000755000004100000410000000000012555334222017461 5ustar www-datawww-datasprockets-rails-2.3.2/lib/sprockets/rails/0000755000004100000410000000000012555334222020573 5ustar www-datawww-datasprockets-rails-2.3.2/lib/sprockets/rails/task.rb0000644000004100000410000000374612555334222022074 0ustar www-datawww-datarequire 'rake' require 'rake/sprocketstask' require 'sprockets' require 'action_view' require 'action_view/base' module Sprockets module Rails class Task < Rake::SprocketsTask attr_accessor :app def initialize(app = nil) self.app = app super() end def environment if app app.assets else super end end def output if app File.join(app.root, 'public', app.config.assets.prefix) else super end end def assets if app app.config.assets.precompile else super end end def manifest if app Sprockets::Manifest.new(index, output, app.config.assets.manifest) else super end end def cache_path if app "#{app.config.root}/tmp/cache/assets" else @cache_path end end attr_writer :cache_path def define namespace :assets do # Override this task change the loaded dependencies desc "Load asset compile environment" task :environment do # Load full Rails environment by default Rake::Task['environment'].invoke end desc "Compile all the assets named in config.assets.precompile" task :precompile => :environment do with_logger do manifest.compile(assets) end end desc "Remove old compiled assets" task :clean, [:keep] => :environment do |t, args| keep = Integer(args.keep || 2) with_logger do manifest.clean(keep) end end desc "Remove compiled assets" task :clobber => :environment do with_logger do manifest.clobber rm_rf cache_path if cache_path end end end end end end end sprockets-rails-2.3.2/lib/sprockets/rails/helper.rb0000644000004100000410000001671212555334222022406 0ustar www-datawww-datarequire 'action_view' require 'sprockets' require 'active_support/core_ext/class/attribute' module Sprockets module Rails module Helper class << self attr_accessor :precompile, :assets, :raise_runtime_errors end def precompile Sprockets::Rails::Helper.precompile end def assets Sprockets::Rails::Helper.assets end def raise_runtime_errors Sprockets::Rails::Helper.raise_runtime_errors end class AssetFilteredError < StandardError def initialize(source) msg = "Asset filtered out and will not be served: " << "add `Rails.application.config.assets.precompile += %w( #{source} )` " << "to `config/initializers/assets.rb` and restart your server" super(msg) end end class AbsoluteAssetPathError < ArgumentError def initialize(bad_path, good_path, prefix) msg = "Asset names passed to helpers should not include the #{prefix.inspect} prefix. " << "Instead of #{bad_path.inspect}, use #{good_path.inspect}" super(msg) end end if defined? ActionView::Helpers::AssetUrlHelper include ActionView::Helpers::AssetUrlHelper include ActionView::Helpers::AssetTagHelper else require 'sprockets/rails/legacy_asset_tag_helper' require 'sprockets/rails/legacy_asset_url_helper' include LegacyAssetTagHelper include LegacyAssetUrlHelper end VIEW_ACCESSORS = [:assets_environment, :assets_manifest, :assets_prefix, :digest_assets, :debug_assets] def self.included(klass) if klass < Sprockets::Context klass.class_eval do alias_method :assets_environment, :environment def assets_manifest; end class_attribute :config, :assets_prefix, :digest_assets, :debug_assets end else klass.class_attribute(*VIEW_ACCESSORS) end end def self.extended(obj) obj.class_eval do attr_accessor(*VIEW_ACCESSORS) end end def compute_asset_path(path, options = {}) # Check if we are inside Sprockets context before calling check_dependencies!. check_dependencies!(path) if defined?(depend_on) if digest_path = asset_digest_path(path) path = digest_path if digest_assets path += "?body=1" if options[:debug] File.join(assets_prefix || "/", path) else super end end # Computes the full URL to a asset in the public directory. This # method checks for errors before returning path. def asset_path(source, options = {}) unless options[:debug] check_errors_for(source, options) end super(source, options) end alias :path_to_asset :asset_path # Get digest for asset path. # # path - String path # options - Hash options # # Returns String Hex digest or nil if digests are disabled. def asset_digest(path, options = {}) return unless digest_assets if digest_path = asset_digest_path(path, options) digest_path[/-(.+)\./, 1] end end # Expand asset path to digested form. # # path - String path # options - Hash options # # Returns String path or nil if no asset was found. def asset_digest_path(path, options = {}) if manifest = assets_manifest if digest_path = manifest.assets[path] return digest_path end end if environment = assets_environment if asset = environment[path] return asset.digest_path end end end # Override javascript tag helper to provide debugging support. # # Eventually will be deprecated and replaced by source maps. def javascript_include_tag(*sources) options = sources.extract_options!.stringify_keys if options["debug"] != false && request_debug_assets? sources.map { |source| check_errors_for(source, :type => :javascript) if asset = lookup_asset_for_path(source, :type => :javascript) asset.to_a.map do |a| super(path_to_javascript(a.logical_path, :debug => true), options) end else super(source, options) end }.flatten.uniq.join("\n").html_safe else sources.push(options) super(*sources) end end # Override stylesheet tag helper to provide debugging support. # # Eventually will be deprecated and replaced by source maps. def stylesheet_link_tag(*sources) options = sources.extract_options!.stringify_keys if options["debug"] != false && request_debug_assets? sources.map { |source| check_errors_for(source, :type => :stylesheet) if asset = lookup_asset_for_path(source, :type => :stylesheet) asset.to_a.map do |a| super(path_to_stylesheet(a.logical_path, :debug => true), options) end else super(source, options) end }.flatten.uniq.join("\n").html_safe else sources.push(options) super(*sources) end end protected # Ensures the asset is included in the dependencies list. def check_dependencies!(dep) depend_on(dep) depend_on_asset(dep) rescue Sprockets::FileNotFound end # Raise errors when source is not in the precompiled list, or # incorrectly contains the assets_prefix. def check_errors_for(source, options) return unless self.raise_runtime_errors source = source.to_s return if source.blank? || source =~ URI_REGEXP asset = lookup_asset_for_path(source, options) if asset && asset_needs_precompile?(asset.logical_path, asset.pathname.to_s) raise AssetFilteredError.new(asset.logical_path) end full_prefix = File.join(self.assets_prefix || "/", '') if !asset && source.start_with?(full_prefix) short_path = source[full_prefix.size, source.size] if lookup_asset_for_path(short_path, options) raise AbsoluteAssetPathError.new(source, short_path, full_prefix) end end end # Returns true when an asset will not be available after precompile is run def asset_needs_precompile?(source, filename) if assets_environment && assets_environment.send(:matches_filter, precompile || [], source, filename) false else true end end # Enable split asset debugging. Eventually will be deprecated # and replaced by source maps in Sprockets 3.x. def request_debug_assets? debug_assets || (defined?(controller) && controller && params[:debug_assets]) rescue return false end # Internal method to support multifile debugging. Will # eventually be removed w/ Sprockets 3.x. def lookup_asset_for_path(path, options = {}) return unless env = assets_environment path = path.to_s if extname = compute_asset_extname(path, options) path = "#{path}#{extname}" end env[path] end end end end sprockets-rails-2.3.2/lib/sprockets/rails/legacy_asset_tag_helper.rb0000644000004100000410000000163112555334222025756 0ustar www-datawww-datarequire 'sprockets' module Sprockets module Rails # Backports of AssetTagHelper methods for Rails 2.x and 3.x. module LegacyAssetTagHelper include ActionView::Helpers::TagHelper def javascript_include_tag(*sources) options = sources.extract_options!.stringify_keys sources.uniq.map { |source| tag_options = { "src" => path_to_javascript(source) }.merge(options) content_tag(:script, "", tag_options) }.join("\n").html_safe end def stylesheet_link_tag(*sources) options = sources.extract_options!.stringify_keys sources.uniq.map { |source| tag_options = { "rel" => "stylesheet", "media" => "screen", "href" => path_to_stylesheet(source) }.merge(options) tag(:link, tag_options) }.join("\n").html_safe end end end end sprockets-rails-2.3.2/lib/sprockets/rails/version.rb0000644000004100000410000000010012555334222022574 0ustar www-datawww-datamodule Sprockets module Rails VERSION = "2.3.2" end end sprockets-rails-2.3.2/lib/sprockets/rails/legacy_asset_url_helper.rb0000644000004100000410000000776412555334222026022 0ustar www-datawww-datarequire 'sprockets' module Sprockets module Rails # Backports of AssetUrlHelper methods for Rails 2.x and 3.x. module LegacyAssetUrlHelper URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//} def asset_path(source, options = {}) source = source.to_s return "" unless source.present? return source if source =~ URI_REGEXP tail, source = source[/([\?#].+)$/], source.sub(/([\?#].+)$/, '') if extname = compute_asset_extname(source, options) source = "#{source}#{extname}" end if source[0] != ?/ source = compute_asset_path(source, options) end relative_url_root = defined?(config.relative_url_root) && config.relative_url_root if relative_url_root source = "#{relative_url_root}#{source}" unless source.starts_with?("#{relative_url_root}/") end if host = compute_asset_host(source, options) source = "#{host}#{source}" end "#{source}#{tail}" end alias_method :path_to_asset, :asset_path def asset_url(source, options = {}) path_to_asset(source, options.merge(:protocol => :request)) end ASSET_EXTENSIONS = { :javascript => '.js', :stylesheet => '.css' } def compute_asset_extname(source, options = {}) return if options[:extname] == false extname = options[:extname] || ASSET_EXTENSIONS[options[:type]] extname if extname && File.extname(source) != extname end ASSET_PUBLIC_DIRECTORIES = { :audio => '/audios', :font => '/fonts', :image => '/images', :javascript => '/javascripts', :stylesheet => '/stylesheets', :video => '/videos' } def compute_asset_path(source, options = {}) dir = ASSET_PUBLIC_DIRECTORIES[options[:type]] || "" File.join(dir, source) end def compute_asset_host(source = "", options = {}) request = self.request if respond_to?(:request) if defined? config host = config.asset_host elsif defined? ActionController::Base.asset_host host = ActionController::Base.asset_host end host ||= request.base_url if request && options[:protocol] == :request return unless host if host.respond_to?(:call) arity = host.respond_to?(:arity) ? host.arity : host.method(:call).arity args = [source] args << request if request && (arity > 1 || arity < 0) host = host.call(*args) elsif host =~ /%d/ host = host % (Zlib.crc32(source) % 4) end if host =~ URI_REGEXP host else protocol = options[:protocol] || (request ? :request : :relative) case protocol when :relative "//#{host}" when :request "#{request.protocol}#{host}" else "#{protocol}://#{host}" end end end def javascript_path(source, options = {}) path_to_asset(source, {:type => :javascript}.merge(options)) end alias_method :path_to_javascript, :javascript_path def stylesheet_path(source, options = {}) path_to_asset(source, {:type => :stylesheet}.merge(options)) end alias_method :path_to_stylesheet, :stylesheet_path def image_path(source, options = {}) path_to_asset(source, {:type => :image}.merge(options)) end alias_method :path_to_image, :image_path def video_path(source, options = {}) path_to_asset(source, {:type => :video}.merge(options)) end alias_method :path_to_video, :video_path def audio_path(source, options = {}) path_to_asset(source, {:type => :audio}.merge(options)) end alias_method :path_to_audio, :audio_path def font_path(source, options = {}) path_to_asset(source, {:type => :font}.merge(options)) end alias_method :path_to_font, :font_path end end end sprockets-rails-2.3.2/lib/sprockets/rails.rb0000644000004100000410000000013712555334222021121 0ustar www-datawww-datarequire 'sprockets/rails/version' if defined? Rails::Railtie require 'sprockets/railtie' end sprockets-rails-2.3.2/lib/sprockets/railtie.rb0000644000004100000410000001255312555334222021445 0ustar www-datawww-datarequire 'rails' require 'rails/railtie' require 'action_controller/railtie' require 'active_support/core_ext/module/remove_method' require 'sprockets' require 'sprockets/rails/helper' require 'sprockets/rails/version' module Rails class Application # Hack: We need to remove Rails' built in config.assets so we can # do our own thing. class Configuration remove_possible_method :assets end # Undefine Rails' assets method before redefining it, to avoid warnings. remove_possible_method :assets remove_possible_method :assets= # Returns Sprockets::Environment for app config. def assets @assets ||= Sprockets::Environment.new(root.to_s) do |env| env.version = ::Rails.env path = "#{config.root}/tmp/cache/assets/#{::Rails.env}" env.cache = Sprockets::Cache::FileStore.new(path) env.context_class.class_eval do include ::Sprockets::Rails::Helper end end end attr_writer :assets # Returns Sprockets::Manifest for app config. attr_accessor :assets_manifest end class Engine < Railtie # Skip defining append_assets_path on Rails <= 4.2 unless initializers.find { |init| init.name == :append_assets_path } initializer :append_assets_path, :group => :all do |app| if paths["app/assets"].respond_to?(:existent_directories) app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories) app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories) app.config.assets.paths.unshift(*paths["app/assets"].existent_directories) else app.config.assets.paths.unshift(*paths["vendor/assets"].paths.select { |d| File.directory?(d) }) app.config.assets.paths.unshift(*paths["lib/assets"].paths.select { |d| File.directory?(d) }) app.config.assets.paths.unshift(*paths["app/assets"].paths.select { |d| File.directory?(d) }) end end end end end module Sprockets class Railtie < ::Rails::Railtie LOOSE_APP_ASSETS = lambda do |filename, path| path =~ /app\/assets/ && !%w(.js .css).include?(File.extname(filename)) end class OrderedOptions < ActiveSupport::OrderedOptions def configure(&block) self._blocks << block end end config.assets = OrderedOptions.new config.assets._blocks = [] config.assets.paths = [] config.assets.prefix = "/assets" config.assets.manifest = nil config.assets.precompile = [LOOSE_APP_ASSETS, /(?:\/|\\|\A)application\.(css|js)$/] config.assets.version = "" config.assets.debug = false config.assets.compile = true config.assets.digest = false rake_tasks do |app| require 'sprockets/rails/task' Sprockets::Rails::Task.new(app) end config.after_initialize do |app| config = app.config # Configuration options that should invalidate # the Sprockets cache when changed. app.assets.version = [ app.assets.version, config.assets.version, config.action_controller.relative_url_root, (config.action_controller.asset_host unless config.action_controller.asset_host.respond_to?(:call)), Sprockets::Rails::VERSION ].compact.join('-') # Copy config.assets.paths to Sprockets config.assets.paths.each do |path| app.assets.append_path path end app.assets.js_compressor = config.assets.js_compressor app.assets.css_compressor = config.assets.css_compressor # Run app.assets.configure blocks config.assets._blocks.each do |block| block.call app.assets end # No more configuration changes at this point. # With cache classes on, Sprockets won't check the FS when files # change. Preferable in production when the FS only changes on # deploys when the app restarts. if config.cache_classes app.assets = app.assets.index end manifest_assets_path = File.join(config.paths['public'].first, config.assets.prefix) if config.assets.compile app.assets_manifest = Sprockets::Manifest.new(app.assets, manifest_assets_path, config.assets.manifest) else app.assets_manifest = Sprockets::Manifest.new(manifest_assets_path, config.assets.manifest) end ActiveSupport.on_load(:action_view) do include Sprockets::Rails::Helper # Copy relevant config to AV context self.debug_assets = config.assets.debug self.digest_assets = config.assets.digest self.assets_prefix = config.assets.prefix # Copy over to Sprockets as well context = app.assets.context_class context.assets_prefix = config.assets.prefix context.digest_assets = config.assets.digest context.config = config.action_controller self.assets_environment = app.assets if config.assets.compile self.assets_manifest = app.assets_manifest end Sprockets::Rails::Helper.precompile ||= app.config.assets.precompile Sprockets::Rails::Helper.assets ||= app.assets Sprockets::Rails::Helper.raise_runtime_errors = app.config.assets.raise_runtime_errors if config.assets.compile if app.routes.respond_to?(:prepend) app.routes.prepend do mount app.assets => config.assets.prefix end end end end end end sprockets-rails-2.3.2/metadata.yml0000644000004100000410000000736012555334222017207 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: sprockets-rails version: !ruby/object:Gem::Version version: 2.3.2 platform: ruby authors: - Joshua Peek autorequire: bindir: bin cert_chain: [] date: 2015-06-23 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: sprockets requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '2.8' - - < - !ruby/object:Gem::Version version: '4.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '2.8' - - < - !ruby/object:Gem::Version version: '4.0' - !ruby/object:Gem::Dependency name: actionpack requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '3.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '3.0' - !ruby/object:Gem::Dependency name: activesupport requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '3.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '3.0' - !ruby/object:Gem::Dependency name: railties requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '3.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '3.0' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: sass requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: uglifier requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' description: email: josh@joshpeek.com executables: [] extensions: [] extra_rdoc_files: [] files: - README.md - lib/sprockets/rails/helper.rb - lib/sprockets/rails/legacy_asset_tag_helper.rb - lib/sprockets/rails/legacy_asset_url_helper.rb - lib/sprockets/rails/task.rb - lib/sprockets/rails/version.rb - lib/sprockets/rails.rb - lib/sprockets/railtie.rb - LICENSE homepage: https://github.com/rails/sprockets-rails licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.0.14 signing_key: specification_version: 4 summary: Sprockets Rails integration test_files: [] sprockets-rails-2.3.2/LICENSE0000644000004100000410000000203712555334222015705 0ustar www-datawww-dataCopyright (c) 2014 Joshua Peek Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. sprockets-rails-2.3.2/README.md0000644000004100000410000001556412555334222016170 0ustar www-datawww-data# Sprockets Rails Provides Sprockets implementation for Rails 4.x (and beyond) Asset Pipeline. ## Installation ``` ruby gem 'sprockets-rails', :require => 'sprockets/railtie' ``` Or alternatively `require 'sprockets/railtie'` in your `config/application.rb` if you have Bundler auto-require disabled. ## Usage ### Rake task **`rake assets:precompile`** Deployment task that compiles any assets listed in `config.assets.precompile` to `public/assets`. **`rake assets:clean`** Only removes old assets (keeps the most recent 3 copies) from `public/assets`. Useful when doing rolling deploys that may still be serving old assets while the new ones are being compiled. **`rake assets:clobber`** Nuke `public/assets` and clear the Sprockets file system cache. #### Customize If the basic tasks don't do all that you need, it's straight forward to redefine them and replace them with something more specific to your app. You can also redefine the task with the built in task generator. ``` ruby require 'sprockets/rails/task' # clean the old tasks Rake::Task["assets:environment"].clear Rake::Task["assets:precompile"].clear Rake::Task["assets:clean"].clear Rake::Task["assets:clobber"].clear Sprockets::Rails::Task.new(Rails.application) do |t| t.environment = lambda { Rails.application.assets } t.assets = %w( application.js application.css ) t.keep = 5 end ``` Each asset task will invoke `assets:environment` first. By default this loads the Rails environment. You can override this task to add or remove dependencies for your specific compilation environment. Also see [Sprockets::Rails::Task](https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/rails/task.rb) and [Rake::SprocketsTask](https://github.com/sstephenson/sprockets/blob/master/lib/rake/sprocketstask.rb). ### Initializer options **`config.assets.precompile`** Add additional assets to compile on deploy. Defaults to `application.js`, `application.css` and any other non-js/css file under `app/assets`. **`config.assets.raise_runtime_errors`** Set to `true` to enable additional runtime error checking. Recommended in the `development` environment to minimize unexpected behavior when deploying to `production`. **`config.assets.paths`** Add additional load paths to this Array. Rails includes `app/assets`, `lib/assets` and `vendor/assets` for you already. Plugins might want to add their custom paths to this. **`config.assets.version`** Set a custom cache buster string. Changing it will cause all assets to recompile on the next build. ``` ruby config.assets.version = 'v1' # after installing a new plugin, change loads paths config.assets.version = 'v2' ``` **`config.assets.prefix`** Defaults to `/assets`. Changes the directory to compile assets to. **`config.assets.manifest`** Defines the full path to be used for the asset precompiler's manifest file. Defaults to a randomly-generated filename in the `config.assets.prefix` directory within the public folder. **`config.assets.digest`** Link to undigest asset filenames. This option will eventually go away. Unless when `compile` is disabled. **`config.assets.debug`** Enable expanded asset debugging mode. Individual files will be served to make referencing filenames in the web console easier. This feature will eventually be deprecated and replaced by Source Maps in Sprockets 3.x. **`config.assets.compile`** Enables Sprockets compile environment. If disabled, `Rails.application.assets` will be unavailable to any ActionView helpers. View helpers will depend on assets being precompiled to `public/assets` in order to link to them. You can still access the environment by directly calling `Rails.application.assets`. **`config.assets.configure`** Invokes block with environment when the environment is initialized. Allows direct access to the environment instance and lets you lazily load libraries only needed for asset compiling. ``` ruby config.assets.configure do |env| env.js_compressor = :uglify # or :closure, :yui env.css_compressor = :sass # or :yui require 'my_processor' env.register_preprocessor 'application/javascript', MyProcessor env.logger = Rails.logger env.cache = ActiveSupport::Cache::FileStore.new("tmp/cache/assets") end ``` ## Complementary plugins The following plugins provide some extras for the Sprockets Asset Pipeline. * [coffee-rails](https://github.com/rails/coffee-rails) * [sass-rails](https://github.com/rails/sass-rails) **NOTE** That these plugins are optional. The core coffee-script, sass, less, uglify, (any many more) features are built into Sprockets itself. Many of these plugins only provide generators and extra helpers. You can probably get by without them. ## Changes from Rails 3.x * Only compiles digest filenames. Static non-digest assets should simply live in public/. * Unmanaged asset paths and urls fallback to linking to public/. This should make it easier to work with both compiled assets and simple static assets. As a side effect, there will never be any "asset not precompiled errors" when linking to missing assets. They will just link to a public file which may or may not exist. * JS and CSS compressors must be explicitly set. Magic detection has been removed to avoid loading compressors in environments where you want to avoid loading any of the asset libraries. Assign `config.assets.js_compressor = :uglify` or `config.assets.css_compressor = :sass` for the standard compressors. * The manifest file is now in a JSON format. Since it lives in public/ by default, the initial filename is also randomized to obfuscate public access to the resource. * `config.assets.manifest` (if used) must now include the manifest filename, e.g. `Rails.root.join('config/manifest.json')`. It cannot be a directory. * Two cleanup tasks. `rake assets:clean` is now a safe cleanup that only removes older assets that are no longer used. While `rake assets:clobber` nukes the entire `public/assets` directory and clears your filesystem cache. The clean task allows for rolling deploys that may still be linking to an old asset while the new assets are being built. ## Contributing Usual bundler workflow. ``` shell $ git clone https://github.com/rails/sprockets-rails.git $ cd sprockets-rails/ $ bundle install $ bundle exec rake test ``` [![Build Status](https://secure.travis-ci.org/rails/sprockets-rails.png)](http://travis-ci.org/rails/sprockets-rails) ## Releases sprockets-rails 2.x will primarily target sprockets 2.x with future compatibility for 3.x. Consider upgrading to sprockets-rails 3.x to take full advantage of 3.x features. The minor and patch version will be updated according to [semver](http://semver.org/). * Any new APIs or config options that don't break compatibility will be in a minor release * Any time the sprockets dependency is bumped, there will be a new minor release * Simple bug fixes will be patch releases ## License Copyright © 2014 Joshua Peek. Released under the MIT license. See `LICENSE` for details.