4

我有一个大型 Stylus 项目,我需要从 vanilla Gulp 移植到 Laravel Mix。

其中app.styl包括另一个来自 node_modules 的东西framework.styl@import我不能在 Laravel Mix 中使用useandimport标志(或者至少我不知道如何使用),因为

  1. 对于某些依赖项,我只需要在 node_modules 文件夹中导入特定文件,而不是全部
  2. 对于一个依赖项,我需要在导入之前在 Stylus 中设置一长串变量。

主样式

@import "includes/framework.styl"

/* Other stuff */

包括/framework.styl

$variable = 1.5
$other = white
/* bunch more */

@import "jeet"
@import "foo/src/specific.styl"

ks-no-conflict = true
@import "kouto-swiss"

/* other stuff */

所有的@importsframework.styl都来自 node_modules。这些依赖项和文件的加载顺序很重要,因为如果加载顺序错误,它们可能会相互冲突。

但是,当我运行时npm run dev,它抱怨它无法在framework.styl.

我尝试用, , ,等为@import路径添加前缀;似乎没有任何效果。这一切都导致:~/node_modules/./node_modules/../../../../node_modules

failed to locate @require file node_modules/jeet/styl/index.styl

使用../../../../node_modulesand ../../../node_modules,我得到以下信息;

Module build failed: Error: EISDIR: illegal operation on a directory, read
    at Error (native)

我怎样才能让 Stylus 在 node_modules (我的首选解决方案)中找到这些依赖项,或者在 Laravel Mix 选项中复制上述内容?

4

0 回答 0