svelte-tampermonkey
🚀 Vite + Svelte Tampermonkey boilerplate
English | 简体ä¸æ–‡
src/header.js
can edit tampermonkey header info
Start
npm install
npm run dev
- Copy
dist/main.user.dev.js
to tampermonkey
- Visit 百度,you can see the effect in the upper right corner
- Every time you modify the code, it will be hot updated. You only need to refresh the page
Build
npm run build
- Release
dist/main.user.js
QA
Why Vite + Svelte ?
- "no runtime" and The file size is small enough to meet the script release requirements
- Tree Shaking
- The responsive provided by Svelte fully meets the needs of script development
- Rollup packaging is fast
- More...
Why Not TypeScript ?
- This is not absolute. Of course, you can use ts
- Scripts often iterate very fast. In most cases, using TS will only increase the mental burden
- Reduce unnecessary trouble and make development more flexible
Why design the directory structure like this
- In order to meet most of the needs
- Facilitate the decoupling of all modules without affecting each other's development
Directory Structure
├─dist
└─src
├─pages
│ └─www
│ └─packages
│ └─TestA
│ ├─apis
│ ├─components
│ └─views
└─utils
Development Suggestions
- The folders under
pages
are recommended to be classified according to the secondary domain name, for example:
- If you need a responsive div, create a new
svelte file
under views
to write it
- In other cases, you can write JS files normally