Sha256: d7cd3f3d0713396ecf51a5be7f0ee6deb1b164a1ad3f80bffd1dedbea8807308

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

# encoding: utf-8

require 'classy_assets/version'
module ClassyAssets
  class Configuration
    def self.configure
      yield self
    end
    
    def self.asset_digest
      @asset_digest ||= false
    end

    def self.asset_digest=(digest)
      @asset_digest = digest
    end

    def self.asset_paths
      @asset_paths ||= build_asset_path(%w(fonts images javascripts stylesheets))
    end

    def self.asset_paths=(paths)
      @asset_paths = paths.to_a
    end

    def self.asset_host
      @asset_host ||= nil
    end

    def self.asset_host=(host)
      @asset_host = host
    end

    def self.asset_prefix
      @asset_prefix ||= 'assets'
    end

    def self.asset_prefix=(prefix)
      @asset_prefix = prefix
    end

    def self.css_compressor
      @css_compressor ||= :yui
    end

    def self.css_compressor=(compressor)
      @css_compressor = compressor
    end

    def self.debug_mode
      @debug_mode ||= (ENV['RACK_ENV'] == 'development')
    end

    def self.debug_mode=(debug)
      @debug_mode = debug
    end

    def self.js_compressor
      @js_compressor ||= :uglifier
    end

    def self.js_compressor=(compressor)
      @js_compressor = compressor
    end

    def self.public_path
      @public_path ||= './public'
    end
    
    def self.public_path=(path)
      @public_path = path
    end

    def self.root_path
      @root_path ||= '.'
    end
    
    def self.root_path=(path)
      @root_path = path
    end

    def self.build_asset_path(dir_names)
      dir_names.map! do |dir_name|
        File.join(root_path, asset_prefix, dir_name)
      end
      dir_names
    end

    def self.sprockets
      @sprockets ||= Sprockets::Environment.new(root_path)
      asset_paths.each { |asset_path| @sprockets.append_path asset_path }
      @sprockets
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
classy_assets-0.1.0 lib/classy_assets.rb