Module: HamlCoffeeAssets::HamlCoffee

Defined in:
lib/haml_coffee_assets/haml_coffee.rb

Overview

Handles compilation of Haml CoffeeScript templates to pure JavaScript.

Defined Under Namespace

Classes: Configuration

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



104
105
106
# File 'lib/haml_coffee_assets/haml_coffee.rb', line 104

def configuration
  @configuration
end

Class Method Details

.compile(name, source, jst = true) ⇒ String

Compile the Haml CoffeeScript template.

Parameters:

  • name (String)

    the template name

  • source (String)

    the template source code

  • jst (Boolean) (defaults to: true)

    if a JST template should be generated

Returns:

  • (String)

    the compiled template in JavaScript



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/haml_coffee_assets/haml_coffee.rb', line 120

def compile(name, source, jst = true)
  self.configuration ||= Configuration.new
  runtime.call('HamlCoffeeAssets.compile', name, source, jst,
               configuration.namespace, configuration.format, configuration.uglify, configuration.basename,
               configuration.escapeHtml, configuration.escapeAttributes, configuration.cleanValue,
               configuration.customHtmlEscape, configuration.customCleanValue,
               configuration.customPreserve, configuration.customFindAndPreserve,
               configuration.customSurround, configuration.customSucceed, configuration.customPrecede,
               configuration.preserveTags, configuration.selfCloseTags,
               configuration.context)
end

.configure {|self.configuration| ... } ⇒ Object

Configure HamlCoffee

Yields:



108
109
110
111
# File 'lib/haml_coffee_assets/haml_coffee.rb', line 108

def configure
  self.configuration ||= Configuration.new
  yield self.configuration
end