Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yingye/rollup-plugin-banner
Rollup plugin to append content before js bundle.
https://github.com/yingye/rollup-plugin-banner
banner license rollup rollup-plugin
Last synced: 27 days ago
JSON representation
Rollup plugin to append content before js bundle.
- Host: GitHub
- URL: https://github.com/yingye/rollup-plugin-banner
- Owner: yingye
- License: mit
- Created: 2018-11-11T12:17:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:19:04.000Z (almost 2 years ago)
- Last Synced: 2024-05-11T17:21:29.222Z (7 months ago)
- Topics: banner, license, rollup, rollup-plugin
- Language: JavaScript
- Homepage:
- Size: 569 KB
- Stars: 16
- Watchers: 2
- Forks: 7
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome - banner - Append content before js bundle. (Plugins / Output)
README
# rollup-plugin-banner
[![Build Status](https://travis-ci.org/yingye/rollup-plugin-banner.svg?branch=master)](https://travis-ci.org/yingye/rollup-plugin-banner)
[![npm version](https://badge.fury.io/js/rollup-plugin-banner.svg)](https://badge.fury.io/js/rollup-plugin-banner)
[![change-log](https://img.shields.io/badge/changelog-md-blue.svg)](https://github.com/yingye/rollup-plugin-banner/blob/master/CHANGELOG.md)## Introduction
Rollup plugin to append content before js bundle.
The difference between this plugin and the output.banner parameter provided by the rollup is that the banner will not be cleaned up. For example, your project uses the rollup-plugin-uglify plugin, the output file will not contain the output.banner parameter you set. So you need rollup-plugin-banner to solve this problem.
## Usage
Install the plugin with NPM:
```
npm install --save-dev rollup-plugin-banner
```Add it to your rollup configuration:
```js
import banner from 'rollup-plugin-banner'export default {
plugins: [
banner('rollup-plugin-banner v<%= pkg.version %> by<%= pkg.author %>')
]
}```
## API
banner(options)
### options
Type: String / Object
#### String
Input:
```
banner('rollup-plugin-banner v<%= pkg.version %> by <%= pkg.author %>')
```Output:
```
// rollup-plugin-banner v0.1.0 by yingye
```The pkg is the content of the project package.json.
If your text is multi-line, you can use '\n'.
```
banner('rollup-plugin-banner\nv<%= pkg.version %>\nby <%= pkg.author %>')
```output:
```
/**
* rollup-plugin-banner
* v0.1.0
* by yingye
*/
```#### Object
```
banner({
file: path.join(__dirname, 'banner.txt'),
encoding: 'utf-8' // default is utf-8
})
```