JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 286463
  • Score
    100M100P100Q171619F
  • License MIT

PostCSS plugin for exposing JavaScript functions

Package Exports

  • postcss-functions

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-functions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

postcss-functions Build Status

PostCSS plugin for exposing JavaScript functions.

Installation

npm install postcss-functions

Usage

var fs = require('fs');
var postcss = require('postcss');
var functions = require('postcss-functions');

var options = {
    //options
};

var css = fs.readFileSync('input.css', 'utf8');

var output = postcss()
  .use(functions(options))
  .process(css)
  .css;

Example of a function call:

body {
    prop: foobar();
}

Options

functions

Type: Object

An object containing functions. The function name will correspond with the object key.

require('postcss-functions')({
    functions: {
        foo: function () {
            return 'bar';
        }
    }
});

glob

Type: string|string[]

Loads files as functions based on one or more glob patterns. The function name will correspond with the file name.

require('postcss-functions')({
    glob: path.join(__dirname', 'functions', '*.js')
});