renyamizuno / posthtml-style-expantion

PostHTML plugin expansion link rel="stylesheet"
MIT License
4 stars 0 forks source link
posthtml posthtml-plugin stylesheets

PostHTML-Style-Expansion npm version Build Status

PostHTML plugin expand link rel="stylesheet".

Install

npm i -D posthtml-style-expansion

Usage

const posthtml = require('posthtml')

posthtml([require('posthtml-style-expansion')({ root: './', encoding: 'utf-8' })])
  .process('<link expand="true" href="https://github.com/renyamizuno/posthtml-style-expantion/blob/master/path/index.css" rel="stylesheet">')
  .then( result => console.log(result.html))

Example

input.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>posthtml-style-expansion</title>
  <link expand="true" href="https://github.com/renyamizuno/posthtml-style-expantion/blob/master/path/index.css" rel="stylesheet">
</head>
<body>

</body>
</html>

output.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>posthtml-style-expansion</title>
  <style>.test{display:block;}</style>
</head>
<body>

</body>
</html>

Options

root: Root folder

encoding: Default utf-8