rollup-plugin-userscript-header

Rollup plugin for generating userscript headers

Usage no npm install needed!

<script type="module">
  import rollupPluginUserscriptHeader from 'https://cdn.skypack.dev/rollup-plugin-userscript-header';
</script>

README

rollup-plugin-userscript-header

A Rollup plugin to add userscript metadata blocks to files.

Install

Using npm:

npm install rollup-plugin-userscript-header --save-dev

Usage

Create a rollup.config.js configuration file and import the plugin:

import userscriptHeader from 'rollup-plugin-userscript-header';

export default {
    input: 'src/index.js',
    output: {
        dir: 'output',
        format: 'cjs'
    },
    plugins: [userscriptHeader()]
}

Then call rollup either via the CLI or the API.

The metadata block will be filled in with the default fields found in project.json.

Options

cwd

Type: String
Default: process.cwd()

Sets the directory of the package.json which is used for default values.

overwrite

Type: Object
Default: null

Values which will overwrite the default metablock.

userscriptHeader({
    overwrite: {
        name: 'New Name',
        match: [
            'http://somedomainname.com',
            'http://anotherdomainname.com'
        ]
    }
})

License

LICENSE (MIT)