postcss-add-dependencies

1.1.1 • Public • Published

postcss-add-dependencies

PostCSS plugin to add dependencies that are necessary for webpack to understand when it needs to run recompilation on the changed files. This is usefull to watch config files of PostCSS plugins which do not watch it by default. For example:

Install

To install with npm or yarn, use

npm install --save postcss-add-dependencies

// or

yarn add postcss-add-dependencies

Options

dependencies

Array of dependencies. Dependency (array item) is object with type and file/dir properties. Possible dependency types:

{ type : "dependency", file : "/abs/path/to/file.ext" }
{ type : "build-dependency", file : "/abs/path/to/file.ext" }
{ type : "missing-dependency", file : "/abs/path/to/file.ext" }
{ type : "context-dependency", file : "/abs/path/to/file.ext" }
{ type : "dir-dependency", dir : "/abs/path/to/dir" }
{ type : "asset", file : "/abs/path/to/file.ext", content : ..., sourceMap : ..., info : ... }

See https://github.com/webpack-contrib/postcss-loader/blob/v6.2.0/src/index.js#L189-L217

Usage

postcss.config.js

const path = require("path");

const dependencies = [
    { type : "dependency", file : path.resolve("/abs/path/to/file.ext") },
    { type : "dir-dependency", dir : path.resolve("/abs/path/to/dir") },
];

module.exports = {
    plugins: [
        // Plugins for PostCSS
        ['postcss-add-dependencies', { dependencies : dependencies }],
    ],
};

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i postcss-add-dependencies

      Weekly Downloads

      149

      Version

      1.1.1

      License

      MIT

      Unpacked Size

      5.42 kB

      Total Files

      4

      Last publish

      Collaborators

      • nolimitdev