https://github.com/violentmonkey/rollup-plugin-userscript
Rollup plugin for userscript
https://github.com/violentmonkey/rollup-plugin-userscript
Last synced: 3 months ago
JSON representation
Rollup plugin for userscript
- Host: GitHub
- URL: https://github.com/violentmonkey/rollup-plugin-userscript
- Owner: violentmonkey
- License: mit
- Created: 2021-03-24T14:39:37.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-07T08:48:44.000Z (6 months ago)
- Last Synced: 2025-04-02T15:41:07.309Z (3 months ago)
- Language: TypeScript
- Size: 152 KB
- Stars: 14
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rollup-plugin-userscript


Automatically parse metadata and set `@grant`s.
With this plugin, `@grant`s for [`GM_*` functions](https://violentmonkey.github.io/api/metadata-block/) will be added at compile time.
## Usage
Add the plugin to rollup.config.js:
```js
import userscript from 'rollup-plugin-userscript';const plugins = [
// ...
userscript(meta => meta.replace('process.env.AUTHOR', pkg.author)),
];
```Import the metadata file with a suffix `?userscript-metadata` in your script:
```js
import './meta.js?userscript-metadata';
```