Skip to content

renyamizuno/posthtml-style-expantion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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="/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="/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