Module: HamlCoffeeAssets

Defined in:
lib/haml_coffee_assets.rb,
lib/haml_coffee_assets/version.rb,
lib/haml_coffee_assets/compiler.rb,
lib/haml_coffee_assets/rails/engine.rb,
lib/haml_coffee_assets/configuration.rb,
lib/haml_coffee_assets/action_view/resolver.rb,
lib/haml_coffee_assets/tilt/template_handler.rb,
lib/haml_coffee_assets/action_view/template_handler.rb

Overview

Haml Coffee Assets main module

Defined Under Namespace

Modules: ActionView, Compiler, Rails, Tilt Classes: Configuration

Constant Summary collapse

VERSION =
'1.12.0'

Class Method Summary collapse

Class Method Details

.configHamlCoffeeAssets::Configuration

Get the Haml Coffee Assets configuration

Returns:



7
8
9
# File 'lib/haml_coffee_assets/configuration.rb', line 7

def self.config
  @config ||= ::HamlCoffeeAssets::Configuration.new
end

.helpers(compile = true) ⇒ String

Get the Haml Coffee Assets helper file

Parameters:

  • compile (Boolean) (defaults to: true)

    whether to compile the CS helpers or not

Returns:

  • (String)

    the helpers content



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/haml_coffee_assets.rb', line 41

def self.helpers(compile=true)
  require 'erb'

  content = File.read(HamlCoffeeAssets.helpers_path)
  script = ERB.new(content).result(binding)

  if compile
    require 'coffee-script'
    script = CoffeeScript.compile(script)
  end

  script
end

.helpers_pathString

Get the path to the ‘hamlcoffee.js.coffee.erb` helper file.

Returns:

  • (String)

    the absolute path to the helpers file



32
33
34
# File 'lib/haml_coffee_assets.rb', line 32

def self.helpers_path
  File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'assets', 'javascripts', 'hamlcoffee.js.coffee.erb'))
end