Module: Assette

Extended by:
Assette
Included in:
Assette
Defined in:
lib/assette.rb,
lib/assette/config.rb,
lib/assette/reader.rb,
lib/assette/server.rb,
lib/assette/template.rb,
lib/assette/middleware.rb,
lib/assette/view_helper.rb,
lib/assette/template_set.rb,
lib/assette/compiled_file.rb,
lib/assette/post_processor.rb,
lib/assette/post_processors/js_min.rb,
lib/assette/post_processors/css_min.rb,
lib/assette/post_processors/cache_buster.rb,
lib/assette/cli.rb

Defined Under Namespace

Modules: PostProcessor, Reader, ViewHelper Classes: CLI, CompilationError, CompiledFile, Config, File, Middleware, Server, Template, TemplateSet

Constant Summary collapse

CONFIG_WRAPPER =
'ASSETTE CONFIG'
VERSION =
File.open(File.expand_path(File.dirname(__FILE__)+'/../VERSION')).read.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.PostProcessor(type) ⇒ Object



61
62
63
64
65
# File 'lib/assette/post_processor.rb', line 61

def self.PostProcessor(type)
  c = Class.new(PostProcessor::Base)
  c.set_outputs(type)
  c
end

.Reader(type) ⇒ Object



97
98
99
100
101
# File 'lib/assette/reader.rb', line 97

def self.Reader(type)
  c = Class.new(Reader::Base)
  c.set_outputs(type)
  c
end

Instance Method Details

#compiled_path(i, path) ⇒ Object



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

def compiled_path i, path
  File.join(Assette.config.asset_host(i),Assette.config.compiled_path(path))
end

#config(optional_path = nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/assette/config.rb', line 2

def config(optional_path=nil)
  return @config if @config && !optional_path
  
  f = %w{assets.rb config/assets.rb}
  f.unshift(optional_path.to_s) if optional_path

  p = f.find { |path| File.exist?(path) }
  raise "Can't find config file" unless p
  @config = Assette::Config.load(p)
end

#loggerObject



24
25
26
# File 'lib/assette.rb', line 24

def logger
  @logger ||= Logger.new('/dev/null')
end

#logger=(l) ⇒ Object



28
29
30
# File 'lib/assette.rb', line 28

def logger=(l)
  @logger = l
end

#preloader_codeObject

shitty



10
11
12
13
# File 'lib/assette/template_set.rb', line 10

def preloader_code
  pp = preloader_file
  pp.all_code if pp
end

#preloader_fileObject

shitty



3
4
5
6
7
# File 'lib/assette/template_set.rb', line 3

def preloader_file
  p = Assette.config.template_preloader
  pp = Assette.config.find_file_from_relative_path(p) if p
  Assette::File.open(pp) if pp
end