The Wayback Machine - https://web.archive.org/web/20230110012747/https://github.com/posthtml/posthtml-cli
Skip to content

posthtml/posthtml-cli

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

posthtml-cli

PostHTML сommand line interface

Actions StatusnodeNPM versionXO code styleCoveralls Status

npm downloadsnpm

Install

$ npm install --global posthtml-cli

Note: This project is compatible with node v10+

Usage

$ posthtml --help

  Usage:
    $ posthtml <patterns>

  Options:
    --output -o      Output File or Folder
    --config -c      Path to config file
    --use -u         PostHTML plugin name
    --root -r        Mirror the directory structure relative to this path in the output directory(default: .)
    --allInOutput -a Save the nesting structure for output
    --skip -s        Skip parsing file
    --help -h        CLI Help
    --version -v     CLI Version

  Examples:
    $ posthtml input.html
    $ posthtml input.html -o output.html
    $ posthtml inputFolder/*.html !unicorn.html
    $ posthtml '**/*.html' '\!**/unicorn.html'
    $ posthtml '**/*.html' -s unicorn.html
    $ posthtml input-one.html input-two.html -o outputFolder
    $ posthtml input.html -o output.html -c posthtml.js
    $ posthtml input.html -o output.html -u posthtml-bem --posthtml-bem.elemPrefix __
    $ posthtml inputFolder/*.html -o outputFolder
    $ posthtml inputFolder/**/*.html -o outputFolder -a
    $ posthtml '**/*.html' -o outputFolder -a -r inputFolder

⚠️ Please note that when using patterns on the command line * and ! escaping of characters is necessary. When using as npm scripts, you only need to screen the pattern *. About the reasons

Options

{
  "root": "src",
  "input": "*.html",
  "output": "dist",
  "skip": ["skip.html", "file.html"],
  "options": {
    "sync": true,
    "directives": [{"name": "?php", "start": "<", "end": ">"}]
  },
  "plugins": {
    "posthtml-plugin-name": {
      "property": "value"
    }
  }
}

example config .posthtmlrc