Use gulp release
to do a full build and generate release.zip.
Export MOZ=true
to disable modules that are incompatible with Firefox.
Make sure the old build folder are removed first, because otherwise contents inside will be copied to the zip.
- default: build for development
- watch: auto compile files on changes. Does not include files used in settings page
- release: build, compress and zip release. Cleaning the build directory (
rm -rf build
) before running this is highly recommended. - build-emoji-db: update src/emojipicker/emoji.json
Each plugin are CommonJS packages located in src/
. To create plugins:
-
Create a subfolder in
src/
-
Create package.json:
{ "name": "<plugin name>", "description": "<setting name>", "category": "<setting category>", "default_enabled": true, "private": true, "content_scripts": [ { "matches": ["http://mylive.in.th/"], "js": ["content_script.js"], "css": ["content_script.css"], "run_at": "document_end", "stop_angular": true } ] }
Make sure
"private": true
is listed, the package name is the same as folder name. -
Create
content_script.js
import $ from 'jquery'; import plugin from 'core/plugin'; plugin('<plugin name>', () => { // plugin code goes here });
The
plugin
command checks whether the plugin is enabled in settings, and call the callback if it is. It also prevent multiple loading of the module. -
Create
content_script.scss
. (scss
is automatically compiled tocss
during build step). Note that it will ALWAYS load regardless of plugin status.
<tools/chrome-manifest.js> will collect some chrome-related metadata from CommonJS package file automatically. Here are the metadata collected:
permissions
: See permissions in Chrome docs. The hardcoded permissions are:- `http://mylive.in.th/*``
- `http://.mylive.in.th/``
storage
content_scripts
: See content script in Chrome docs. The build script will merge items with same permissions automatically.- Additionally,
"stop_angular": true
can be listed alongsidejs
to disable angular for that page. To resume angular execution, passtrue
as the third argument toplugin
.
- Additionally,
The settings page and loader also collect additional data:
description2
(String): Help textno_disable
(Boolean): Hide disable option from settings page. This is for core modules only.settings
(Object): Setting options. The enable/disable option is automatically generated, this is for additional options.- See notifyfollowing for example
default_enabled
(Boolean): Is this plugin enabled after MyLive Enhancements is installed/updated.