Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@greenwood/plugin-postcss

Package Overview
Dependencies
Maintainers
0
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@greenwood/plugin-postcss

A Greenwood plugin for loading PostCSS configuration and applying it to your CSS.

  • 0.30.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
75
decreased by-2.6%
Maintainers
0
Weekly downloads
 
Created
Source

@greenwood/plugin-postcss

Overview

A Greenwood plugin for loading PostCSS configuration and applying it to your CSS. For more information and complete docs on Greenwood, please visit our website.

This package assumes you already have @greenwood/cli installed.

Installation

You can use your favorite JavaScript package manager to install this package.

# npm
$ npm i -D @greenwood/plugin-postcss

# yarn
$ yarn add @greenwood/plugin-postcss --dev

# pnpm
$ pnpm add -D @greenwood/plugin-postcss

Usage

Add this plugin to your greenwood.config.js:

import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss';

export default {
  // ...

  plugins: [
    greenwoodPluginPostCss()
  ]
}

By default, this plugin provides a default postcss.config.js that includes support for postcss-preset-env using browserslist and postcss-import.

export default {
  plugins: [
    (await import('postcss-import')).default,
    (await import('postcss-preset-env')).default
  ]
};

Note: Greenwood provides the behavior of postcss-import out of the box.

Options

Configuration

To use your own PostCSS configuration, you'll need to create two (2) config files in the root of your project, by which you can provide your own custom plugins / settings that you've installed.

  • postcss.config.js
  • postcss.config.mjs

Example:

// postcss.config.js
module.exports = {
  plugins: [
    require('postcss-nested')
  ]
};

// postcss.config.mjs
export default {
  plugins: [
    (await import('postcss-nested')).default
  ]
};

Eventually once PostCSS adds support for ESM configuration files, then this will drop to only needing one file.

Extend Config

If you would like to extend the default configuration with your own custom postcss.config.js, you can enable the extendConfig option of this plugin

import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss';

export default {
  // ...

  plugins: [
    greenwoodPluginPostCss({
      extendConfig: true
    })
  ]
};

This will then process your CSS with PostCSS using the configured plugins / settings you provide, merged after the default Greenwood configuration listed above.

Keywords

FAQs

Package last updated on 14 Nov 2024

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc