karma-haml-coffee-preprocessor

0.2.1 • Public • Published

karma-haml-coffee-preprocessor

Preprocessor to compile haml coffee templates on the fly.

Installation

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

{
  "devDependencies": {
    "karma": "~0.10",
    "karma-haml-coffee-preprocessor": "~0.2"
  }
}

You can simple do it by:

npm install karma-haml-coffee-preprocessor --save-dev

Configuration

Following code shows the default configuration...

// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      '**/*.hamlc': ['hamlc']
    },

    coffeePreprocessor: {
      // options passed to the haml-coffee compiler
      options: {
        namespace: "window.JST",
        logicalPathStrip: "templates"
      },
      // Removes base and sprockets until logicalMountPath with options.logicalPathStrip
      transformLogicalPath: function(filepath) {
        var logicalPath = filepath.replace(/\.jst.hamlc/, '');
        return logicalPath.substring(logicalPath.indexOf(options.logicalPathStrip));
      }
    }
  });
};

For more information on Karma see the homepage.

Package Sidebar

Install

npm i karma-haml-coffee-preprocessor

Weekly Downloads

167

Version

0.2.1

License

MIT

Last publish

Collaborators

  • isaiah