Socket
Socket
Sign inDemoInstall

@acta/rollup-plugin-postcss

Package Overview
Dependencies
95
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @acta/rollup-plugin-postcss

A rollup plugin to import transpiled styles files as modules width PostCSS.


Version published
Weekly downloads
6
increased by100%
Maintainers
1
Install size
10.6 MB
Created
Weekly downloads
 

Readme

Source

Rollup PostCSS @acta/rollup-plugin-postcss

A rollup plugin to import transpiled styles files as modules with PostCSS.

Table of Contents

  • Parsing URLs
  • Formating URLs
  • Dev scripts

Use with rollup

Install with npm i -D @acta/rollup-plugin-postcss. Then in your config file:

...
import postCSS from '@acta/rollup-plugin-postcss';
...
  ...
  plugins: [
    ...
    postCSS({
      minified: true,
      includes: ['.sass', '.scss'],
      excludes: ['node_modules'],
      presetEnv: {
        stage: 2,
        features: [],
        browsers: 'defaults',
      }
    }),
    ...
  ],
  ...

Parametters

All parametters are otpionnal.

  • minified: boolean, should the styles be minified.
  • incldues: the file complete path (en: /Volumes/Projects/foo/bar.scss) contains at least one of the elements of the array. Default value is ['.css', '.pcss', '.sass', '.scss'].
  • excludes: the file complete path does not contain any of the elements of the array. Default value is ['node_modules'].
  • presetEnv: see https://github.com/csstools/postcss-preset-env for complete details.

Input and output

If you have the following styles file:

$mainColor: #00c;

body {
  color: #000;
}

.__SCOPE {
  color: #c00;

  > .example {
    color: $mainColor;
  }
}

And you import them in a JavaScript file with import AppStyles from './AppStyles.scss';, you obtain this object:

{
  hash: '_a7af0989',
  style: `body{
    color:#000
    }
    ._a7af0989{
      color:#c00
    }
    ._a7af0989 > .example{
      color:#00c
    }`
}

It should be injected in a style tag in your DOM.

The value of styles will be minified if you pass minified: true in the options and will be: body{color:#000}._8fd83ea9dc8f28944de69aac4284bba3{color:#c00}._8fd83ea9dc8f28944de69aac4284bba3>.example{color:#00c}

Keywords

FAQs

Last updated on 14 Jan 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc