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

postcss-html

Package Overview
Dependencies
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-html

PostCSS syntax for parsing HTML (and HTML-like)

  • 0.24.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
586K
decreased by-55.34%
Maintainers
2
Weekly downloads
 
Created

What is postcss-html?

The postcss-html npm package is a tool that allows PostCSS to be used with HTML, including HTML-like syntaxes such as XML, XHTML, and HTML with inline styles. It enables developers to process styles within `<style>` tags or inline `style` attributes using PostCSS plugins.

What are postcss-html's main functionalities?

Processing inline styles

This feature allows processing of inline styles within HTML. The code sample demonstrates how to use postcss-html to process a string containing HTML with a `<style>` tag.

const postcssHtml = require('postcss-html');
const result = postcssHtml.process('<style>h1 { color: red; }</style>', { /* options */ }).then(result => {
  console.log(result.html);
});

Processing styles in HTML-like files

This feature processes styles within HTML-like files. The code sample shows how to read an HTML file, process it with postcss-html, and then write the processed HTML to a new file.

const postcssHtml = require('postcss-html');
const fs = require('fs');

fs.readFile('index.html', (err, html) => {
  if (err) throw err;
  postcssHtml.process(html, { /* options */ }).then(result => {
    fs.writeFile('index-processed.html', result.html, (err) => {
      if (err) throw err;
      console.log('The file has been saved!');
    });
  });
});

Other packages similar to postcss-html

Keywords

FAQs

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