/karma-haml-preprocessor

A Karma plugin. Compile haml script to html

Primary LanguageJavaScriptMIT LicenseMIT

karma-preprocessor-haml

A Karma preprocessor that Compile haml script to html.

WARNING: This is a hacked version of karma-haml-preprocessor which now requires haml to run. This was done to allow multiline element declarations which doesn't work in haml-js.

Supports haml-js and haml-coffee as language compilers

Installation

The easiest way is to keep karma-haml-preprocessor as a devDependency in your package.json.

{
  "devDependencies": {
    "karma-haml-preprocessor": "~0.2"
  }
}

You can simple do it by:

npm install karma-haml-preprocessor

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    files: [
      '*.haml'
    ],
    preprocessors: {
      'app/assets/javascripts/**/*.haml'   : 'haml'
    }
  });
};

Options

// karma.conf.js
module.exports = function(config) {
  config.set({
    ...
    hamlPreprocessor: {
      options: {
        language: 'coffee'
      }
    }
  });
};

language

Type: string
Default: js
Accepted values: js, coffee

Specifies the script language and compiler to use alongside HAML. js will use haml-js, coffee uses haml-coffee