【问题标题】:Gulp-sass breaks when changes are made to imported file对导入的文件进行更改时,Gulp-sass 会中断
【发布时间】:2015-12-15 13:01:53
【问题描述】:
  • 我正在使用gulp-sass 编译 sass。我有main.scssgrid.scss 在同一目录中。

  • main.scss 被 gulp watch 监视。

  • grid.scss 被导入到main.scss 并在保存main.scss 时编译没有错误。

问题是当我对@9​​87654328@ 进行更改并保存 gulp-sass 中断并抛出此错误:

    events.js:141
    throw er; // Unhandled 'error' event
    ^
     Error: src\styles\main.scss
     Error: File to import not found or unreadable: grid
     Parent style sheet: stdin
     on line 1 of stdin
     >> @import "grid";
     ^

    at options.error (C:\www\test\node_modules\node-sass\lib\index.js:277:32)

看起来grid.scss 在保存时被视为不存在的文件。有什么解决办法?

提前谢谢你。

【问题讨论】:

    标签: css sass gulp-sass


    【解决方案1】:

    尝试在文件名前添加underline 以忽略文件本身的编译。

    应该是这样的:

    main.scss
    _grid.scss
    

    那么你的文件_grid.scss你只编译成main.scss而不编译自己。

    另外,请确保您对文件/文件夹具有文件权限。可能正在锁定编译器。

    【讨论】:

    • 还是一样,导入的文件是部分的不是问题。谢谢。
    • 你试过看整个文件夹吗?看来您只能观看主文件。
    • main.scss就够了,因为其他人都导入了。
    猜你喜欢
    • 1970-01-01
    • 2016-07-24
    • 2019-05-18
    • 1970-01-01
    • 2014-09-12
    • 1970-01-01
    • 2016-01-30
    • 2016-01-05
    • 2020-02-15
    相关资源
    最近更新 更多