Class: ClassyAssets::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/classy_assets.rb

Class Method Summary collapse

Class Method Details

.asset_digestObject



17
18
19
# File 'lib/classy_assets.rb', line 17

def self.asset_digest
  @asset_digest.nil? ? false : @asset_digest
end

.asset_digest=(digest) ⇒ Object



21
22
23
# File 'lib/classy_assets.rb', line 21

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

.asset_hostObject



33
34
35
# File 'lib/classy_assets.rb', line 33

def self.asset_host
  @asset_host
end

.asset_host=(host) ⇒ Object



37
38
39
# File 'lib/classy_assets.rb', line 37

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

.asset_host_protocolObject



41
42
43
# File 'lib/classy_assets.rb', line 41

def self.asset_host_protocol
  @asset_host_protocol || :relative
end

.asset_host_protocol=(protocol) ⇒ Object



45
46
47
# File 'lib/classy_assets.rb', line 45

def self.asset_host_protocol=(protocol)
  @asset_host_protocol = protocol
end

.asset_pathsObject



25
26
27
# File 'lib/classy_assets.rb', line 25

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

.asset_paths=(paths) ⇒ Object



29
30
31
# File 'lib/classy_assets.rb', line 29

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

.asset_prefixObject



49
50
51
# File 'lib/classy_assets.rb', line 49

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

.asset_prefix=(prefix) ⇒ Object



53
54
55
# File 'lib/classy_assets.rb', line 53

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

.build_asset_path(dir_names) ⇒ Object



97
98
99
100
101
102
# File 'lib/classy_assets.rb', line 97

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

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



13
14
15
# File 'lib/classy_assets.rb', line 13

def self.configure
  yield self
end

.css_compressorObject



57
58
59
# File 'lib/classy_assets.rb', line 57

def self.css_compressor
  @css_compressor || :yui
end

.css_compressor=(compressor) ⇒ Object



61
62
63
# File 'lib/classy_assets.rb', line 61

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

.debug_modeObject



65
66
67
# File 'lib/classy_assets.rb', line 65

def self.debug_mode
  @debug_mode.nil? ? (ENV['RACK_ENV'] == 'development') : @debug_mode
end

.debug_mode=(debug) ⇒ Object



69
70
71
# File 'lib/classy_assets.rb', line 69

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

.js_compressorObject



73
74
75
# File 'lib/classy_assets.rb', line 73

def self.js_compressor
  @js_compressor || :uglifier
end

.js_compressor=(compressor) ⇒ Object



77
78
79
# File 'lib/classy_assets.rb', line 77

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

.public_pathObject



81
82
83
# File 'lib/classy_assets.rb', line 81

def self.public_path
  @public_path || File.join(root_path, 'public')
end

.public_path=(path) ⇒ Object



85
86
87
# File 'lib/classy_assets.rb', line 85

def self.public_path=(path)
  @public_path = path
end

.root_pathObject



89
90
91
# File 'lib/classy_assets.rb', line 89

def self.root_path
  @root_path || '.'
end

.root_path=(path) ⇒ Object



93
94
95
# File 'lib/classy_assets.rb', line 93

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

.sprocketsObject



104
105
106
107
108
109
110
# File 'lib/classy_assets.rb', line 104

def self.sprockets
  @sprockets ||= ::Sprockets::Environment.new(root_path)
  asset_paths.each do |asset_path|
    @sprockets.append_path asset_path unless @sprockets.paths.include?(asset_path)
  end
  @sprockets
end