A Rollup plugin to add userscript metadata blocks to files.
Using npm:
npm install rollup-plugin-userscript-header --save-dev
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
.
Type: String
Default: process.cwd()
Sets the directory of the package.json which is used for default values.
Type: Object
Default: null
Values which will overwrite the default metablock.
userscriptHeader({
overwrite: {
name: 'New Name',
match: [
'http://somedomainname.com',
'http://anotherdomainname.com'
]
}
})