Skip to content

Commit

Permalink
update ci badge
Browse files Browse the repository at this point in the history
  • Loading branch information
borisovg committed May 8, 2024
1 parent d94700a commit 65c703c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://img.shields.io/travis/borisovg/metalsmith-uglify/master.svg?style=flat-square)](https://travis-ci.org/borisovg/metalsmith-uglify/)
[![Tests](https://github.com/borisovg/metalsmith-uglify/actions/workflows/tests.yaml/badge.svg)](https://github.com/borisovg/expressus/metalsmith-uglify/workflows/tests.yaml)
[![Coverage Status](https://img.shields.io/codecov/c/github/borisovg/metalsmith-uglify/master.svg?style=flat-square)](https://codecov.io/gh/borisovg/metalsmith-uglify/)

# metalsmith-uglify
Expand All @@ -8,11 +8,13 @@ This is an [UglifyJS](http://lisperator.net/uglifyjs/) plugin for [Metalsmith](h
## Usage

Install the package:

```
npm install metalsmith-uglify
```

Add the plugin to your Metalsmith build chain:

```
const metalsmith = require('metalsmith');
const uglify = require('metalsmith-uglify');
Expand All @@ -34,11 +36,11 @@ metalsmith(__dirname)

The plugin function accepts a configuration object as the first argument.

* {boolean} **`options.es`** -
- {boolean} **`options.es`** -
Set to use `terser` package instead of `uglify-js`.
It will set also set `options.uglify.ecma = 6` by default.

* {object} **`options.concat`** -
- {object} **`options.concat`** -
Set to concatenate to a single bundle file.

- {string} **`options.concat.file`** -
Expand All @@ -48,35 +50,34 @@ The plugin function accepts a configuration object as the first argument.
Directory where the bundle file will be placed.
This option overrides `options.root`.

* {Array[string]} **`options.files`** -
- {Array[string]} **`options.files`** -
List of files to be processed.
If `options.concat` is set, files will be passed to UglifyJS in that order.
This option is only needed for bundling badly written code (e.g. jQuery) that relies on files being processed in a certain order.
This option overrides `options.filter`.

* {function} **`options.filter`** -
- {function} **`options.filter`** -
Function to filter the list of JavaScript files.
By default `.min.js` files are excluded.

* {string} **`options.root`** -
- {string} **`options.root`** -
Set to limit the plugin to a specific source directory.

* {boolean} **`options.removeOriginal`** -
- {boolean} **`options.removeOriginal`** -
Set to exclude the original (unminified) file from the output directory.

* {boolean} **`options.sameName`** -
- {boolean} **`options.sameName`** -
Set to keep minified name as is without adding `.min`.
This option overrides `options.removeOriginal` and is ignored if `options.concat` is set.

* {object} **`options.uglify`** -
- {object} **`options.uglify`** -
UglifyJS configuration (see [UglifyJS docs](https://github.com/mishoo/UglifyJS2#minify-options)).
Default is `{ sourceMap: { includeSources: true } }`.

* {boolean} **`options.windows`** -
- {boolean} **`options.windows`** -
Set this if you are using the plugin on Windows.
If you are using any of the `root` options, you will need to use `\\` instead of `/` in the path.


## Upgrading from version 1.x

Version 2 is a rewrite of the plugin with significant breaking changes to the options object.
Expand All @@ -98,11 +99,13 @@ Inspect files in `example/` for more information.
Set the `DEBUG` variable to see what the plugin is doing.

If you are troubleshooting the plugin itself then the following should be enough:

```
DEBUG=metalsmith-uglify:info:* node build.js
```

If you think the problem is actually related to something UglifyJS does then you can get more detail:

```
DEBUG=metalsmith-uglify:* node build.js
```

0 comments on commit 65c703c

Please sign in to comment.