Giter Site home page Giter Site logo

rollup-plugin-concatfiles's Introduction

rollup-plugin-concatfiles

Build Status License: 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

// 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

rollup-plugin-concatfiles's People

Contributors

kpulkit29 avatar ud54 avatar uditkumarchawla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rollup-plugin-concatfiles's Issues

Both the NPM and the yarn commands are failing

npm i rollup-plugin-concatfiles       

npm ERR! code ENOVERSIONS
npm ERR! No valid versions available for rollup-plugin-concatfiles
yarn add rollup-plugin-concatfiles

error Received malformed response from registry for "rollup-plugin-concatfiles". The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.