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

beastcss-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beastcss-webpack-plugin

Webpack plugin to inline critical CSS and async load the rest.

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Beastcss Webpack Plugin

Inline critical CSS and async load the rest.

Installation

npm i -D beastcss-webpack-plugin

or

yarn add -D beastcss-webpack-plugin

Usage

Create a Beastcss plugin instance with the given options.

// webpack.config.js
const BeastcssWebpackPlugin = require('beastcss-webpack-plugin');

module.exports = {
  plugins: [
    new BeastcssWebpackPlugin({
      // optional configuration (see below)
    }),
  ],
};

That's it! Now when you run Webpack, the CSS used by your HTML will be inlined and the imports for your full CSS will be converted to load asynchronously.

Options

path

Type: String

Default: ''

Base path location of the CSS files.

publicPath

Type: String

Default: ''

Public path of the CSS resources. This prefix is removed from the href attribute.

external

Type: Boolean

Default true

Process external stylesheets.

internal

Type: Boolean

Default true

Process internal stylesheets.

additionalStylesheets

Type: Array

Default []

Array of Glob for matching other stylesheets to be used while looking for critical CSS.

externalThreshold

Type: Number

Default 0

Completely inline external stylesheets smaller than a given size.

merge

Type: Boolean

Default true

Merged inlined stylesheets into a single <style></style> tag.

pruneSource

Type: Boolean

Default false

Remove inlined rules from the external stylesheet.

preloadExternalStylesheets

Type: Boolean

Default false

Preload external stylesheets.

asyncLoadExternalStylesheets

Type: Boolean

Default true

Async load external stylesheets.

noscriptFallback

Type: Boolean

Default true

Add <noscript> fallback to load external stylesheets.

exclude

Type: Function|Regexp

Exclude matching external stylesheets from processing.

whitelist

Type: String[]|Regexp[]

An array of css selectors to be considered as used rules.

fontFace

Type: Boolean

Default: false

Inline used @font-face rules.

keyframes

Type: Boolean

Default: false

Inline used @keyframes rules.

fs

Type: Object

Filesystem to be used when reading/writing to external stylesheets files.

logLevel

Type: String

Default: 'info'

Set the printed output verbosity. See available levels.

logger

Type: Object

Provide a custom logger interface.

Log Level

Controls the printed output verbosity. Specifies the level the logger should use. A logger will not produce output for any log level beneath the specified level. Available levels and order are:

  • trace
  • debug
  • info
  • warn
  • error
  • silent

Custom Logger Interface

interface Logger {
  info: (msg: string, id?: string) => void;
  warn: (msg: string, id?: string) => void;
  error: (msg: string, id?: string) => void;
  trace: (msg: string, id?: string) => void;
  debug: (msg: string, id?: string) => void;
}

Keywords

FAQs

Package last updated on 31 Oct 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

  • 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