油猴扩展的问题

油猴脚本扩展经常莫名其妙的崩溃,而修复后所有的脚本就丢失了,得时时备份。这样还是不够方便,直接在开发仓库里开发,然后通过引用脚本的方式来使用。、

https://github.com/cvzi/rollup-userscript-template 直接使用这个模版。

油猴脚本可以分为页面脚本和沙盒脚本,一旦引用了 GM 开头的脚本,就意味着在沙盒运行。而一般情况下注入页面运行(// @grant none)。

rollup-userscript-template

This is a template repository for a userscript.
It bundles typescript, react and JSX/TSX script files into a single userscript file with rollup

Features:

Installation

Clone the repository and install dependencies with npm

git clone [email protected]:cvzi/rollup-userscript-template.git
cd rollup-userscript-template
npm install

Usage

Bundle

Bundle everything from src/ into dist/bundle.user.js:

npm run build

or

npx rollup --config

Development server

npm run serve

or

node -r esm server.js

This will automatically update dist/bundle.user.js when code changes and serve it on localhost:8124.

It also creates a second userscript dist/dev.user.js, if you install it in Tampermonkey, it will automatically fetch the latest version from http://localhost:8124/bundle.user.js once you reload a website with F5.

Bundle without source map

Bundle for publishing without sourcemapping to dist/release-3.2.1.user.js

npm run build:release

or on Windows

npm run build:release:win32

Other

  • Typescript types for GM.* object are incomplete. See types/GM/index.d.ts
  • Currently react is not bundled, but imported with @require. To bundle it, remove output.globals and external from rollup.config.mjs
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇