Socket
Book a DemoInstallSign in
Socket

postcss-add-dependencies

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

1.1.1
latest
Source
npmnpm
Version published
Weekly downloads
448
-35.45%
Maintainers
1
Weekly downloads
 
Created
Source

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:

  • https://www.npmjs.com/package/postcss-mixins mixinsDir and mixinsFiles options
  • https://www.npmjs.com/package/postcss-custom-properties importFrom option
  • https://www.npmjs.com/package/postcss-color-mod-function importFrom option
  • and many other plugins and postcss.config.js file too

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 }],
    ],
};

Keywords

webpack

FAQs

Package last updated on 26 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.