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

preact-cli-plugin-critical-css

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

preact-cli-plugin-critical-css

Preact CLI plugin for adding critical css to your pre-rendered routes

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-81.82%
Maintainers
1
Weekly downloads
 
Created
Source

preact-cli-plugin-critical-css npm version

Preact CLI plugin that adds critical css to your pre-rendered routes using html-critical-webpack-plugin.

Installation

Install via npm:

npm i -D preact-cli-plugin-critical-css

or yarn:

yarn add preact-cli-plugin-critical-css --dev

then include it in your project by creating a preact.config.js file:

import criticalCssPlugin from "preact-cli-plugin-critical-css";

export default (config, env) => {
	const options = {
		// Passed directly to the 'critical' module (this is optional)
	};

	criticalCssPlugin(config, env, options);
};

Default options

The plugin sets some default options which can be overridden:

const defaultOptions = {
	// Inline the generated critical-path CSS.
	inline: true,

	// Minify critical-path CSS when inlining.
	minify: true,

	// Extract inlined styles from referenced stylesheets.
	extract: false,

	// Viewport width
	width: 1280,

	// Viewport height.
	height: 600,

	// Your build directory to find css files.
	base: path.resolve(env.dest),

	// The path to a prerendered route. (e.g. index.html)
	src: filePath,

	// Write the generated critical-path CSS to this file.
	dest: filePath
};

Configuration

Full list of possible options that are passed to critical are available here.

License

MIT © matthewlynch

Keywords

FAQs

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