Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kpulkit29/rollup-plugin-concatfiles
https://github.com/kpulkit29/rollup-plugin-concatfiles
concat content files rollup rollup-plugin rollup-plugin-concat
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kpulkit29/rollup-plugin-concatfiles
- Owner: kpulkit29
- License: mit
- Created: 2019-11-18T07:49:53.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:20:40.000Z (almost 2 years ago)
- Last Synced: 2024-04-09T22:38:58.240Z (8 months ago)
- Topics: concat, content, files, rollup, rollup-plugin, rollup-plugin-concat
- Language: JavaScript
- Size: 1.28 MB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - concatfiles - Concatenate files to bundle or other files. (Plugins / Output)
README
# rollup-plugin-concatfiles
[![Build Status](https://travis-ci.com/kpulkit29/rollup-plugin-concatFiles.svg?branch=master)](https://travis-ci.com/kpulkit29/rollup-plugin-concatFiles)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)Rollup plugin to concatenate files/content to the generated output. This plugin would enable the user to concatenate files to the output or any other file in general.
## Install
```
// yarn
yarn add rollup-plugin-concatfiles// npm
npm i rollup-plugin-concatfiles
```## Usage
```javascript
// rollup.config.js
import {concatFiles} from "rollup-plugin-concatfiles";
export default [
{
input: "testUtils/core.js",
output: {
file: "dist/test-1.js",
format: "iife",
sourceMap: true
},
plugins: [
concatFiles({
files: {
"dist/test-1.js": {
banner:["Add your banner content"],
concatFiles:['license.txt', 'dist/test-1.js'],
footer:["Add your footer content"]
},
"dist/temp.js": {
banner:[SOME_FILE_PATH],
concatFiles:['src/core.js'],
footer:[SOME_FILE_PATH]
}
}
})
]
}
];
```In the above mentioned example ```dist/test-1.js``` will be the output generated by rollup and concatFiles plugin will accumulate all the content mentioned under the **files** key & dump that into ```dist/test-1.js```. **IMPORTANT**: Old content will be replaced with the concatenated content.
**rollup-plugin-concatfiles can be used to modify content of build file as well as other files.**
**Note**: Banner can be an array of normal strings or file paths (in the form of string) or both. Similarly for footer.
Concatenation order for the above example
content in ```dist/test-1.js``` = Banner + license.txt + dist/test-1.js + Footer
content in ```dist/temp.js``` = Banner + src/core.js + Footer
## Configuration and other features
**Files**
TYPE: ```Object```
Each key in this object should be a valid filename(.js extension supported) to which concatenated content will be saved.
**Banner**
TYPE: ```Array```
Banner would be at the top of the content. Should be passed on as an empty array if you do not want to use this key.
**Footer**
TYPE: ```Array```
Footer would be at the bottom of the content. Should be passed on as an empty array if you do not want to use this key.
### Other features
- Default separator is ```\n```. Cannot be altered as of now.
- Banner can be an array of normal strings or file paths (in the form of string) or both. Similarly for footer.
- Currently the plugin is capable of reading of .txt or .js files and can only generate output in .js file## Contributors