Skip to content

Commit

Permalink
Document compressing into multiple formats
Browse files Browse the repository at this point in the history
Closes #10
  • Loading branch information
kryops committed Apr 5, 2020
1 parent 0dee543 commit bef3dc9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,29 @@ rollup({
}).then(/* ... */)
```

### Compressing into multiple formats

To support compressing your bundle into multiple different formats, you can add this plugin multiple times with different configurations:

```ts
import { compress } from 'brotli'
import { rollup } from 'rollup'
import gzipPlugin from 'rollup-plugin-gzip'

rollup({
input: 'src/index.js',
plugins: [
// GZIP compression as .gz files
gzipPlugin(),
// Brotil compression as .br files
gzipPlugin({
customCompression: content => compress(Buffer.from(content)),
fileName: '.br',
}),
],
}).then(/* ... */)
```

## License

MIT

0 comments on commit bef3dc9

Please sign in to comment.