It's May again, which means I can get B coins as a big member. However, Bilibili has made some changes, which means I need to modify the reminder script I wrote before.
"- It's really difficult to determine how detailed the instructions should be -"
Script acquisition and instructions can be found at:
I created a rollup plugin:
wdssmq/rollup-plugin-monkey: Develop GM Scripts using rollup.js:
"Small Code" rollup.js Development of GM Scripts Demonstration_Bilibili:
Until now, I used to put functional scripts for the same website into one file. For example, the script for Bilibili used to have 330 lines, and it was really painful to maintain and modify.
"It seems more convenient to split it into smaller files and automatically concatenate them!" ← Although I think so, I'm just a lazy person...
Fortunately, I finally started to fill this gap not long ago, using the "rollup.js" solution.
The tutorial for rollup.js itself can be found at the end of this article. In fact, the reason I decided to write this article at this time is because Ruan Yifeng happened to write an introduction.
If you also want to use rollup.js to build GM Scripts, you can refer to my usage method:
- The application environment for GM Scripts is a browser, so the corresponding output format is
- GM Scripts need to include the
==UserScript== …… ==/UserScript==comment at the beginning, which can be concatenated by rollup.js as a
- The configuration definition file
rollup.config.jssupports importing content from external sources as parameters, so the value of the
bannercan be written in a separate file, such as
src/__info.js. The name of the script can also be provided by this file.
- Therefore, different script projects can use the same
rollup.config.jscontent, and only need to modify the definition in
- I created an
empty_defas the initial project, which includes
src/_base.js, encapsulating various "initial constants or functions". "- It just feels like the style is not very consistent -"
src/main.js, you can use
import _bcoin from './_bcoin';to simply concatenate different files together. Although you will get a yellow line saying "Import of non-existent exports", that's exactly how we want to use it.
userscript/bilibili: https://github.com/wdssmq/userscript/tree/master/bilibili "- Due to historical reasons, the exported file is still
later.user.js. Should I change it?"
Latest B Coin Reminder: https://github.com/wdssmq/userscript/blob/master/bilibili/src/_bcoin.js "- It's just a reminder and cannot automatically claim the coins"
Getting Started with Rollup.js - Ruan Yifeng's Blog:
Module Syntax - ES6 Tutorial - WangDoc: