New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browserify-postcss

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-postcss

transform contents using postcss

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
110
decreased by-46.34%
Maintainers
1
Weekly downloads
 
Created
Source

browserify-postcss

version status dependencies devDependencies

A browserify transform to work with postcss.

Example

The build script:

var browserify = require('browserify')
var fs = require('fs')

var b = browserify(__dirname + '/src/entry.js')
b.transform('browserify-postcss', {
  // a list of postcss plugins
  plugin: [
    'postcss-import',
    'postcss-advanced-variables',
    ['postcss-custom-url', [
      ['inline', { maxSize: 10 }],
      ['copy', {
        assetOutFolder: __dirname + '/static/assets',
        baseUrl: 'assets',
        name: '[name].[hash]',
      }],
    ]],
  ],
  // basedir where to search plugins
  basedir: __dirname + '/src',
  // insert a style element to apply the styles
  inject: true,
})
b.bundle().pipe(
  fs.createWriteStream(to)
)

entry.js:

require('./entry.css')

console.log('styles from entry.css are applied')

Options

plugin

Specify a list of postcss plugins to apply.

Type: String, Array Default: null

basedir

Specify where to look for plugins.

postCssOptions

Specify the options for the postcss processor.

The from and to fields will be set to the css file path by default.

The to option is used to calculated url() in the final styles. However, if your postcss plugin does not need it, don't bother to specify.

inject

Specify how to use the styles:

If true, styles are applied immediately. If false, require('style.css') will return the string representation of the styles.

extensions

A list of file extensions to identify styles.

Type: Array

Default: ['.css', '.scss', '.sass']

Watch

Imported files will NOT be watched when used with watchify.

  • reduce-css: bundle css files without requireing them in js.

Keywords

FAQs

Package last updated on 11 Feb 2018

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