Package Exports
- postcss-html
- postcss-html/lib/html-parser
- postcss-html/lib/stringify
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
PostCSS HTML Syntax
PostCSS Syntax for parsing HTML / Markdown / vue component
Getting Started
First thing's first, install the module:
npm install postcss-html --save-dev
If you want support SCSS/SASS/LESS/SugarSS syntaxh, you need to install the corresponding module.
- SCSS: PostCSS-SCSS
- SASS: PostCSS-SASS
- LESS: PostCSS-LESS
- SugarSS: SugarSS
Use Cases
var syntax = require('postcss-html');
postcss(plugins).process(source, { syntax: syntax }).then(function (result) {
// An alias for the result.css property. Use it with syntaxes that generate non-CSS output.
result.content
});
Style Transformations
The main use case of this plugin is to apply PostCSS transformations directly to HTML source code. For example, if you ship a theme written in style tag in HTML and need Autoprefixer to add the appropriate vendor prefixes to it; or you need to lint style source in HTML with a plugin such as Stylelint.
Inferring the syntaxes of stylesheet files
When passing a stylesheet file, syntaxes can automatically be inferred from the following file extensions: .less
, .sass
, .scss
, .sss
and .css
.
Custom unknown syntax
var syntax = require('postcss-html');
postcss(plugins).process(html, {
syntax: syntax({
stylus: require('postcss-stylus')
})
}).then(function (result) {
result.content
});