创建根节点(Root Node)
- 打开 ClashX,进入主菜单。
- 在主菜单中找到“Root Node”,点击“Create”,创建一个新的根节点。
- 根节点是 ClashX 的基础,用于定义 Web 环境。
添加环境配置(Environment Configuration)
- 在根节点中,添加一个子节点,
config,并设置为root。 - 这是 ClashX 的默认环境,通常用于测试或基础配置。
- 确保根节点和环境配置是唯一的,避免冲突。
添加 App 资源(App Resources)
- 在根节点中,添加一个子节点,
app,并设置为default。 - 这是 ClashX 的默认 App 资源,用于定义 Web 应用的基本配置。
- 添加 App 资源时,需要选择一个 App 序列号(App Sequence ID),并添加 App 文件,如
index.html、styles.css等。
设置继承关系(Set Up Inheritance)
- 在根节点中,添加一个子节点,
config.specific, 并设置为true。 specific子节点用于定义 App 资源在特定子节点中生效。- 在
config.specific子节点中,添加一个子节点inherited,设置为true。 - 在
config.specific子节点中,添加 App 资源,路径如./app.specific.index.html。 - 当根节点运行时,
app.specific应该会在指定子节点中生效。
添加 Sub-Nodes
- 在根节点中,添加多个子节点,用于定义多个独立的 Web 环境。
- 每个子节点将被视为一个独立的环境配置。
添加 App 资源到 Sub-Nodes
- 在根节点中,添加一个子节点,
config.sub1,设置为default。 - 在
config.sub1子节点中,添加 App 资源,路径如./app.sub1.index.html。 - 确保每个子节点的 App 资源路径正确。
添加 Sub-Nodes 的 App 资源
- 在根节点中,添加一个子节点,
config.sub2,设置为default。 - 在
config.sub2子节点中,添加 App 资源,路径如./app.sub2.index.html。 - 确保子节点的 App 资源路径正确。
添加 Sub-Nodes 的 App 资源到 Sub-Nodes
- 在根节点中,添加一个子节点,
config.sub3,设置为default。 - 在
config.sub3子节点中,添加 App 资源,路径如./app.sub3.index.html。 - 确保子节点的 App 资源路径正确。
添加 Sub-Nodes 的 App 资源到 Sub-Nodes 的 App
- 在根节点中,添加一个子节点,
config.sub4,设置为default。 - 在
config.sub4子节点中,添加 App 资源,路径如./app.sub4.index.html。 - 在
config.sub4.sub1.index.html中添加 App 资源,路径如./app.sub4.sub1.index.html。 - 只有当
config.sub4子节点运行时,config.sub4.sub1的 App 资源才会生效。
测试配置
- 确认每个子节点的 App 资源路径正确。
- 使用 ClashX 测试环境进行配置测试。
- 确保应用在多个子节点上运行时,App 资源在指定的子节点中生效。
确保环境配置正确
- 确保根节点和环境配置在多个子节点上正确。
- 检查是否选择了正确的 App 序列号。
- 确保 App 文件路径正确。
最后检查
- 检查根节点和子节点的配置是否正确。
- 确保没有遗漏或错误添加子节点或 App 资源。
通过以上步骤,您应该能够成功配置 ClashX 节点,实现 Web 应用的独立环境配置,如果有问题,可以参考 ClashX 的文档或联系支持团队。









