karma-autoprefixer-preprocessor

0.1.0 • Public • Published

karma-autoprefixer-preprocessor

A Karma plugin. Add vendor prefix on the fly by autoprefixer.

Installation

npm install karma-autoprefixer-preprocessor --save-dev

Configuration

The simplest configuration

You just need to declare what files should be autoprefixerred

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

Working together with karma-less-preprocessor

less runs first and then autoprefixer runs with generated css files before

multiple preprocessors run in specified order

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

Following code shows the all possible configurations

// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      '**/*.css': ['autoprefixer']
    },
 
    autoprefixerPreprocessor: {
      // options passed to the autoprefixer
      options: {
        // there is only browsers configuration if default one doesn't match your requirement
        browsers: ['last 2 versions', 'ie 8', 'ie 7', 'ff 10']
      },
      // transforming the filenames, you don't have to override transformPath usually
      transformPath: function(path) {
        return path.replace(/\.css$/, '.autoprefixer.css');
      }
    }
  });
};

For more information on Karma see the homepage.

Readme

Keywords

none

Package Sidebar

Install

npm i karma-autoprefixer-preprocessor

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • cloudchen