metalsmith-beautify
A plugin for metalsmith to format html / js.
Last updated 6 years ago by boushley .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install metalsmith-beautify 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 0.2.0                                ...           latest (4 years ago)

9 Versions

  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.7                                ...           6 years ago
  • 0.0.6                                ...           6 years ago
  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 2
Last Day 2
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |