Template for a Tempermonkey/Greasemonkey userscript using webpack
- Make sure a recent version of nodejs and npm is installed on your system (https://nodejs.org)
Under linux you will most likely as well need to add a symlink in /usr/bin: node -> nodejs (sudo ln -s /usr/bin/nodejs /usr/bin/node
)
Or add the bin-folder to your PATH - Install webpack:
npm install -g webpack
(you'll need sudo) - Install webpack-dev-server:
npm install -g webpack-dev-server
(you'll need sudo) - Install sass
- Install ruby
- Windows: use the ruby installer (http://rubyinstaller.org/)
- Linux:
sudo apt-get install ruby
- use gem (ruby's package manager) to install sass:
gem install sass
(you'll need sudo)
- Install ruby
- Load Modules with
npm install
- Install the devLoader.user.js userscript
Change @match to fit your page
- Launch "startDevServer.sh" (Linux) / "startDevServer.bat" (Windows)
- Wait for the message: "bundle is now VALID"
- refresh page
- After changing a file restart from step 2
- Edit userscript.txt to fit your needs
- Launch "pack.sh" (Linux) / "pack.bat" (Windows)
- Your userscript is bundle.user.js
Most likely the maximum number of watchers is surpassed.
Try adding fs.inotify.max_user_watches=524288
to /etc/sysctl.conf and execute sysctl -p
.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p