# jsbeautify-loader

> Webpack loader for jsbeautify

Latest version **0.3.0** (published 2016-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsbeautify-loader
pnpm add jsbeautify-loader
yarn add jsbeautify-loader
bun add jsbeautify-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2016-10-12 |
| First published | 2016-09-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Tomasz Czechowski |
| Maintainers | masteradm |
| Keywords | webpack, webpack-jsbeautify, webpack jsbeautify, jsbeautify, jsbeautify loader, jsbeautify-loader, jsbeautify, jsbeautify loader |

## Links

- npm: https://www.npmjs.com/package/jsbeautify-loader
- Repository: https://github.com/tomaszczechowski/jsbeautify-loader
- Issues: https://github.com/tomaszczechowski/jsbeautify-loader/issues
- npm.io page: https://npm.io/package/jsbeautify-loader

## Dependencies (5)

- [rcloader](https://npm.io/package/rcloader.md) ^0.1.2
- [js-beautify](https://npm.io/package/js-beautify.md) ^1.6.4
- [query-string](https://npm.io/package/query-string.md) ^4.2.3
- [file-extension](https://npm.io/package/file-extension.md) ^2.0.1
- [strip-json-comments](https://npm.io/package/strip-json-comments.md) ^2.0.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2016-10-12
- 0.2.2 — 2016-09-19
- 0.2.1 — 2016-09-19
- 0.2.0 — 2016-09-19

## README

# jsbeautify-loader [![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![dependencies][jsbeautify-loader-dependencies-image]][jsbeautify-loader-dependencies-url]
> Webpack loader for jsbeautify-loader

## Ustage

Code syntax can be either define in `.jsbeautifyrc` file or in webpack config file:

### Example

```javascript
module.exports = {
  jsBeautify: {
    "js": {
      "allowed_file_extensions": ["js"], // optional parameter in case allowed file extension is the same as name of parent property.
      "indent_size": 2,
      "indent_char": " ",
      "space_after_anon_function": true
    },
    "html": {
      "allowed_file_extensions": ["html", "xhtml", "shtml", "xml", "svg"],
      "indent_size": 2
    }
  },

  module: {
    preLoaders: [
      {
        test: /\.(js|html)$/,
        exclude: /node_modules/,
        loader: 'jsbeautify-loader'
      }
    ]
  }
};
```

```javascript
module.exports = {
  jsBeautify: {
    "js": {
      "allowed_file_extensions": ["js"], // optional parameter in case allowed file extension is the same as name of parent property.
      "indent_size": 2,
      "indent_char": " ",
      "space_after_anon_function": true
    },
    "html": {
      "allowed_file_extensions": ["html", "xhtml", "shtml", "xml", "svg"],
      "indent_size": 2
    }
  },

  module: {
    loaders: [
      {
        test: /\.njk$/,
        loader: "file?name=template.html!./index?type=html!nunjucks-html"
      }
    ]
  }
};
```

```javascript
module.exports = {
  jsBeautify: {
    // configuration for each file regardless of its extension.
    "indent_size": 2,
    "indent_char": " ",
    "space_after_anon_function": true
  },

  module: {
    preLoaders: [
      {
        test: /\.(js|html)$/,
        exclude: /node_modules/,
        loader: 'jsbeautify-loader'
      }
    ]
  }
};
```
### Options
#### type
Type: `String`, optional, options: (js|css|html)

Determines what type of jsbeautify handler should be used. If content is a HTML code then type should "html". If type parameter is not specified than the extension of file is taken.

---
All available code formatting options you can find here: [https://github.com/beautify-web/js-beautify](https://github.com/beautify-web/js-beautify)

##### Release History
 * 2016-10-12   v0.3.0   Added type parameter in order to handle specific file's extensions.
 * 2016-09-19   v0.2.2   Initial version.

License: MIT

Author [Tomasz Czechowski
](http://czechowski.pl/)

[travis-url]: http://travis-ci.org/tomaszczechowski/jsbeautify-loader
[travis-image]: https://secure.travis-ci.org/tomaszczechowski/jsbeautify-loader.svg?branch=master
[npm-url]: https://npmjs.org/package/jsbeautify-loader
[npm-image]: https://badge.fury.io/js/jsbeautify-loader.svg
[jsbeautify-loader-dependencies-image]: https://david-dm.org/tomaszczechowski/jsbeautify-loader/status.png
[jsbeautify-loader-dependencies-url]: https://david-dm.org/tomaszczechowski/jsbeautify-loader#info=dependencies

---
_Source: https://npm.io/package/jsbeautify-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
