0.2.1 • Published 10 years ago

karma-haml-coffee-preprocessor v0.2.1

Weekly downloads
239
License
MIT
Repository
github
Last release
10 years ago

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.