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

babel-plugin-postcss

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

babel-plugin-postcss

Replace import from css by content transformed by postcss

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

babel-plugin-postcss

Replace import from css by content transformed by postcss

Examples

Input:

import style1 from './style.css';
import style2 from './style.css'; // options: { tagged: ['css', 'lit-element'] }

Output:

var style1 = '/* style.css content */';
import { css } from 'lit-element';
var style2 = css`
    /* style.css content */
`;

Install

  1. npm install --save-dev babel-plugin-postcss
  2. Add ['babel-plugin-postcss', { options }] to plugins section of babel config.

Options

test

Regular expression or function which test importee for being parsed as style file (css).
Type: RegExp | Function
Default: /\.css$/
Example: /\.css$/ only .css imports will be parsed

postcss

If value is truthy css content will be processed by postcss, postcss config will be loaded by postcss-load-config.
Type: undefined | boolean
Default: undefined

tagged

Wrap css content to tagged template, array of two elements. First is tagged function, second is module where import the tagged function from.
Type: undefined | [string, string]
Default: undefined
Example: ['css', 'lit-element']

Input:

import style3 from './style3.css';

Output:

import { css } from 'lit-element';
var style2 = css`
    /* style3.css content */
`;

Keywords

FAQs

Package last updated on 31 Dec 2020

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