JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 74585
  • Score
    100M100P100Q170210F
  • License MIT

Rollup plugin to trim trailing spaces, compact empty lines, and normalize line endings

Package Exports

  • rollup-plugin-cleanup

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rollup-plugin-cleanup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status npm Version License

rollup-plugin-cleanup

Rollup plugin to trim trailing spaces, compact empty lines, and normalize line endings.

With cleanup, you have:

  • Empty lines compactation (optional, configurable)
  • Remotion of trailing spaces
  • Normalization of line endings (Windows, Unix, or Mac)
  • Source Map support

Why not Uglify?

Uglify is a minifier.

Install

npm install rollup-plugin-cleanup --save-dev

cleanup works in node.js v4 or above (there's a node v0.12 compatible version in the dist/legacy folder).

Usage

import { rollup } from 'rollup';
import cleanup from 'rollup-plugin-cleanup';

rollup({
  entry: 'src/main.js',
  plugins: [
    cleanup()
  ]
}).then(...)

That's it.

By default, only the .js files are processed, but you can restrict or expand this using the rollup global options "include" and "exclude", or the "extensions" option (see below).

Options

Name Default Description
maxEmptyLines 0 Use a positive value or -1 to keep all the lines
eolType unix Allowed values: "win", "mac", "unix"
extensions .js Array of strings with case-insensitive extensions of files to process.

Source Map support is given through the rollup sourceMap option.

TODO

  • 100% test coverage and more tests
  • async mode
  • Better documentation*
  • You tell me...

* For me, write in english is 10x harder than coding JS, so contributions are welcome...