Liferay 7 Theme-Generator:设置父主题(baseTheme)

Liferay 7 Theme-Generator: Setting parent theme (baseTheme)

我已经使用主题生成器创建了一个新主题。 现在,我在同一目录中创建了第二个主题,并尝试使用 gulp extend 设置它的 base/parent 主题,如以下页面所述:

https://github.com/liferay/liferay-theme-tasks https://dev.liferay.com/de/develop/reference/-/knowledge_base/7-0/theme-gulp-tasks

在 运行 命令和选择选项 1) 扩展基本主题之后,我得到以下选项:

  1. 样式化
  2. 无样式
  3. 搜索全局安装的 npm 模块(仅用于开发目的)
  4. 搜索 npm 注册表(已发布的模块)

无论选择3)还是4)都找不到主题包

我真的必须将主题发布到 npm 才能找到它吗?

按照这个解释,我可以使用 npm link:

来实现它

摘录

npm link: symbolic links to the rescue Fortunately npm provides a tool to avoid this tedium. And it's easy to use. But there's a catch.

Here's how it's supposed to work:

  1. cd to src/appy

  2. Run "npm link". This creates a symbolic link from a global folder to the src/appy folder.

  3. cd to src/mysite

  4. Run "npm link appy". This links "node_modules/appy" in this particular project to the global folder, so that "require" calls looking for appy wind up loading it from your development folder, src/appy.

Mission accomplished... almost. If you installed Node in a typical way, using MacPorts or Ubuntu's apt-get, then npm's "global" folders are probably in a location shared system-wide, like /opt/local/npm or /usr/lib/npm. And this is not good, because it means those "npm link" commands are going to fail unless you run them as root.

编辑:当你也可以只在本地需要它时,我用它制作一个 npm 包是错误的。甚至相对路径也有效。示例:

"dependencies": {
    "my-liferay-theme": "file:../My-Liferay-theme",
}