Mixin basics: YAML mode vs JavaScript mode
Mixin merges your customizations into the active profile at load time (Settings → Profile Mixin). It has two authoring modes with very different behavior:
YAML mode: declarative override
mixin:
dns:
enable: true
enhanced-mode: fake-ip
log-level: debug
Whatever field you write replaces the same-named field wholesale. Great for DNS or log-level, where swapping the whole block is fine; wrong for rules — you almost certainly want "append", not "only these remain".
JavaScript mode: programmable merge
module.exports.parse = async (raw, { yaml }) => {
const config = yaml.parse(raw);
// insert two rules ahead of the originals
config.rules = [
"DOMAIN-SUFFIX,mybank.com,DIRECT",
"DOMAIN-KEYWORD,ads,REJECT",
...config.rules,
];
return yaml.stringify(config);
};
JS mode hands you the whole config object — insert rules, filter nodes by name, batch-edit node properties, anything.
Choosing
Only touching DNS / log level → YAML suffices. Anything involving rules or proxies lists → go straight to JS. Remember to flip the Mixin enable switch and re-select the profile to reload.