Userscript developed with modern tech powered by webpack
This template is based on Webpack and webpack-userscript, written in typescript.
I recommend you using Chrome and Tampermonkey to develop a user script. Following steps are based on these two tools.
- create your own repo by click the green button Use this template
- install a user script manager for your browser, Tampermonkey is recommended for Chrome, for more alternatives just check greasyfork
- enable insecure localhost: navigate to
chrome://flags/#allow-insecure-localhost, enable insecure localhost - enable file url access of extensions: navigate to
chrome://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)
- install dependencies by run
yarn(ornpm i) - open dev server by run
yarn dev(ornpm run dev) - <https://127.0.0.1/[your userscript name].proxy.user.js> will be open automatically in browser(click
Advanced->proceedif it shows a security warning) to install the proxy script. by settingopenScriptInstallPagetofalseinuserscript.config.tsyou can turn off this behavior. - open your target webpage to see the effect. by setting
openTargetPageto as your target url inuserscript.config.tsit will open that page automatically for you. - config userscript by modifying
userscript.config.ts, you need to rerunyarn devto make it take effect - config webpack by modifying
webpack.config.ts, you need to rerunyarn devto make it take effect - reload your target webpage after userscript changed
run cmd yarn build(or npm run build), your userscript should be in dist folder with extension .user.js
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 via scriptHeaders.name in webpack.config.ts) is a script's identity, you should not change it's name after published.