简体   繁体   English

Less在meteor中找不到@plugin的路径

[英]Less can't find path for @plugin in meteor

So in my main LESS file, I would have two lines: 所以在我的主要LESS文件中,我会有两行:

@plugin "{}/src/imports/views/stylesheets/plugins/colors.js";
@import "{}/src/imports/views/stylesheets/colors/categories.less";

The @import works as expected, but the @plugin throws an error @import按预期工作,但@plugin抛出错误

Unknown import: {}/src/imports/views/stylesheets/plugins/colors.js

Why is it behaving like that? 为什么它表现得那样?

I'm using less@2.7.11 我用的是less@2.7.11

While Meteor uses less v2.5.0, the first version to support @plugin rules, their asset compiler does not support the loading of files with the import syntax used by @imports in Meteor. 虽然Meteor使用较少的v2.5.0,第一个支持@plugin规则的版本,但它们的资产编译器不支持使用Meteor中@imports使用的导入语法加载文件。

Loading should still work using relative paths 加载仍应使用相对路径


Detail 详情

Meteor's compiler only implements the AbstractFileManager interface which loads imported files for less in a Meteor app. Meteor的编译器只实现了AbstractFileManager接口,该接口在Meteor应用程序中加载较少的导入文件。

In order to support abstract loading of plugins in meteor, it would also have to implement the AbstractPluginLoader interface . 为了支持meteor中插件的抽象加载,它还必须实现AbstractPluginLoader接口

The good news is that this doesn't look too difficult. 好消息是,这看起来并不太难。 I'd start by copying the PluginLoader for Node.js environments and modifying it to do the same thing as the MeteorImportLessFileManager 我首先复制PluginLoader for Node.js环境并修改它以执行与MeteorImportLessFileManager相同的MeteorImportLessFileManager

If you can get it to work, the Meteor community would love to get a PR from you to implement this. 如果你可以让它工作,Meteor社区很乐意从你那里得到PR来实现它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM