Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

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

README.md

metalsmith-beautify

A Metalsmith plugin to format html, css and js.

Installation

$ npm install metalsmith-beautify

Config options

You can pass general options in the options object that will be used for all types of beautification. To see what options are available check the js-beautify tool.

For options that are specific to one language type create a nested object with that types name. To disable formatting of a specific file type set that type to false.

The three file types that are supported are html, javascript and css.

Example Configs

If you want to avoid formatting css and html you would pass this options object:

{
    "css": false,
    "html": false
}

If you want to use four spaces for most indentation, but only two spaces in javascript you would pass this:

{
    "indent_size": 4,
    "indent_char": " ",
    "js": {
        "indent_size": 2
    }
}

CLI Usage

Install via npm and then add the metalsmith-beautify key to your metalsmith.json plugins with any js-beautify options you want, like so:

{
  "plugins": {
    "metalsmith-beautify": {
        "css": false,
        "preserve_newlines": false
    }
  }
}

Javascript Usage

Pass options to the beautify plugin and pass it to Metalsmith with the use method:

var beautify = require('metalsmith-beautify');

metalsmith.use(beautify({
    "js": false,
    "html": {
        "wrap_line_length": 80
    }
}));

License

MIT

Credit

The credit for the heavy lifting here goes to the js-beautify tool.

About

A Metalsmith plugin to format html / js.

Resources

License

Releases

No releases published
You can’t perform that action at this time.