lib/sprockets.rb in sprockets-3.0.0.beta.3 vs lib/sprockets.rb in sprockets-3.0.0.beta.4
- old
+ new
@@ -38,27 +38,29 @@
autoload :PathUtils, 'sprockets/path_utils'
autoload :Utils, 'sprockets/utils'
# Extend Sprockets module to provide global registry
require 'sprockets/configuration'
+ require 'sprockets/context'
extend Configuration
- @root = File.expand_path('..', __FILE__).freeze
- @paths = [].freeze
- @mime_types = {}.freeze
- @mime_exts = {}.freeze
- @encodings = {}.freeze
- @engines = {}.freeze
- @engine_mime_types = {}.freeze
- @transformers = Hash.new { |h, k| {}.freeze }.freeze
- @preprocessors = Hash.new { |h, k| [].freeze }.freeze
- @postprocessors = Hash.new { |h, k| [].freeze }.freeze
- @bundle_reducers = Hash.new { |h, k| {}.freeze }.freeze
- @bundle_processors = Hash.new { |h, k| [].freeze }.freeze
- @compressors = Hash.new { |h, k| {}.freeze }.freeze
- @context_class = Context
- @version = ''
+ @root = File.expand_path('..', __FILE__).freeze
+ @paths = [].freeze
+ @mime_types = {}.freeze
+ @mime_exts = {}.freeze
+ @encodings = {}.freeze
+ @engines = {}.freeze
+ @engine_mime_types = {}.freeze
+ @transformers = Hash.new { |h, k| {}.freeze }.freeze
+ @inverted_transformers = Hash.new { |h, k| {}.freeze }.freeze
+ @preprocessors = Hash.new { |h, k| [].freeze }.freeze
+ @postprocessors = Hash.new { |h, k| [].freeze }.freeze
+ @bundle_reducers = Hash.new { |h, k| {}.freeze }.freeze
+ @bundle_processors = Hash.new { |h, k| [].freeze }.freeze
+ @compressors = Hash.new { |h, k| {}.freeze }.freeze
+ @context_class = Context
+ @version = ''
# Set the default digest
require 'digest/sha2'
@digest_class = Digest::SHA256
@@ -104,19 +106,20 @@
# HTTP content encodings
register_encoding :deflate, EncodingUtils::DEFLATE
register_encoding :gzip, EncodingUtils::GZIP
register_encoding :base64, EncodingUtils::BASE64
+ require 'sprockets/directive_processor'
register_preprocessor 'text/css', DirectiveProcessor
register_preprocessor 'application/javascript', DirectiveProcessor
+ require 'sprockets/bundle'
register_bundle_processor 'application/javascript', Bundle
register_bundle_processor 'text/css', Bundle
- register_bundle_reducer '*/*', :data, :+
- register_bundle_reducer 'application/javascript', :data, Utils.method(:concat_javascript_sources)
- register_bundle_reducer '*/*', :dependency_paths, :+
- register_bundle_reducer '*/*', :links, :+
+ register_bundle_metadata_reducer '*/*', :data, :+
+ register_bundle_metadata_reducer 'application/javascript', :data, Utils.method(:concat_javascript_sources)
+ register_bundle_metadata_reducer '*/*', :links, :+
register_compressor 'text/css', :sass, LazyProcessor.new { SassCompressor }
register_compressor 'text/css', :scss, LazyProcessor.new { SassCompressor }
register_compressor 'text/css', :yui, LazyProcessor.new { YUICompressor }
register_compressor 'application/javascript', :closure, LazyProcessor.new { ClosureCompressor }