Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

create your own userscript with modern technology powered by webpack

License

NotificationsYou must be signed in to change notification settings

oe/webpack-userscript-template

Repository files navigation

code with typescript

Userscript developed with modern tech powered by webpack

This template is based onWebpack andwebpack-userscript, written in typescript.

Usage

I recommend you usingChrome andTampermonkey to develop a user script. Following steps are based on these two tools.

Prepare materials

  1. create your own repo by click the green buttonUse this template
  2. install a user script manager for your browser,  Tampermonkey is recommended for Chrome, for more alternatives just checkgreasyfork

Configure you browser: Chrome

  1. enable insecure localhost: navigate tochrome://flags/#allow-insecure-localhost, enable insecure localhost
  2. enable file url access of extensions: navigate tochrome://extensions/?id=dhdgffkkebhmkfjojejmpbldmpobfkfo(Chrome manage extensions page ofTampermonkey) and enableAllow access to file URLs (you need to manual reload page when dev userscript, see#475 for more detail)

Dev

  1. install dependencies by runyarn (ornpm i)
  2. open dev server by runyarn dev (ornpm run dev)
  3. <https://127.0.0.1/[your userscript name].proxy.user.js> will be open automatically in browser(clickAdvanced ->proceed if it shows a security warning) to install the proxy script. by settingopenScriptInstallPage tofalse inuserscript.config.ts you can turn off this behavior.
  4. open your target webpage to see the effect. by settingopenTargetPage to as your target url inuserscript.config.ts it will open that page automatically for you.
  5. config userscript by modifyinguserscript.config.ts, you need to rerunyarn dev to make it take effect
  6. config webpack by modifyingwebpack.config.ts, you need to rerunyarn dev to make it take effect
  7. reload your target webpage after userscript changed

Build

run cmdyarn build(ornpm run build), your userscript should be indist folder with extension.user.js

Publish

after your script fully tested, you can build it than publish it to the world. here are some platform your can share your script:

notice: userscript name(which can be configured viascriptHeaders.name inwebpack.config.ts) is a script's identity, you should not change it's name after published.

References

  1. userscript docs(from Tampermonkey)
  2. Webpack-userscript
  3. Webpack
  4. Typescript

About

create your own userscript with modern technology powered by webpack

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp