简要记录一下在使用gulp-sass时候踩的坑,虽然不明所以然,但是似乎在https://github.com/dlmanning/gulp-sass/issues/1 找到了答案。

在使用gulpfile配置监听文件更新自动编译时候出现了一个这个错误:“error: File to import not found or unreadable: ./m-body”


而且会出现一种奇怪的现象,当改动某个文件遇到这个报错后再重新启动编译就正常监听了该文件了,但是其他文件却不行,都是得在那个文件报错后再重新启动编译才正常。
尝试各种解决方案都无果,一度以为是gulpfile文件编写有错:

 1 var gulp = require('gulp');
2 var sass = require('gulp-sass');
3 var minifyCSS = require('gulp-minify-css');
4 var rename = require('gulp-rename');
5 var browserSync = require('browser-sync').create();
6
7 // Static server
8 gulp.task('browser-sync', function() {
9 browserSync.init({
10 server: {
11 baseDir: './'
12 }
13 });
14 });
15
16 // Build and Reload css files
17 gulp.task('compressCSS', function() {
18 gulp.src('src/styles/**/*.scss')
19 .pipe(sass({
20 outputStyle: 'compressed'
21 }))
22 .on('error', sass.logError)
23 .pipe(minifyCSS())
24 .pipe(rename({
25 suffix: '.min'
26 }))
27 .pipe(gulp.dest('prd/styles'))
28 .pipe(browserSync.stream());
29 });
30
31
32 // Reload HTML file
33 gulp.task('reloadHTML', function() {
34 gulp.src('./index.html')
35 .pipe(browserSync.stream());
36 });
37
38 // Watch files for changes & recompile
39 gulp.task('watch', function() {
40 gulp.watch(['src/styles/**/*.scss'], ['compressCSS']);
41 gulp.watch(['./index.html'], ['reloadHTML']);
42 });
43
44 // Default task, running just `gulp` will move font, compress js and scss, start server, watch files.
45 gulp.task('default', ['compressCSS', 'browser-sync', 'watch']);

最后在https://github.com/dlmanning/gulp-sass/issues/1 找到了答案:Sublime文本和缓慢的硬盘驱动器的组合造成的。 我们能够通过将设置atomic_save更改为true来解决它。

【gulp-sass】error: File to import not found or unreadable的更多相关文章

  1. 【解决方法】INF file txtsetup.sif is corrupt or missing /// 使用WinSetupFromUSB来U盘安装windows2003(不使用win PE系统)

    [解决方法]INF file txtsetup.sif is corrupt or missing http://blog.csdn.net/zhyl8157121/article/details/8 ...

  2. 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo(转)

    标签: 1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be c ...

  3. 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo

    1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be consi ...

  4. 【MySQL案件】ERROR 1665 (HY000)

    转载请注明: http://blog.csdn.net/jason_asia/article/details/36240815 1.1.1. ERROR 1665 (HY000) [环境的叙述性说明] ...

  5. 【MySQL案件】ERROR 1418

    1.1.1. ERROR 1418 [环境的叙述性说明] mysql5.0.67 [问题叙述性说明] 当它来到创建存储过程ERROR 1418一个错误. # 创建函数SQL声明 CREATE FUNC ...

  6. 【MySQL案例】ERROR 1786 (HY000)

    1.1.1. ERROR 1786 (HY000) [环境描写叙述] msyql5.6.14 [报错信息] 运行create table ... select的时候遇到报错: db1 [test] [ ...

  7. 【已解决】Error running 'xxx项目' Command line is too long(idea版)

    [错误] Error running 'xxx项目': Command line is too long. Shorten command line for xxx or also for Sprin ...

  8. 【Visual Studio】Error: forget to add '#include "stdafx.h"' to your source (转)

    原文转自 http://www.cnblogs.com/qunews/articles/2200313.html [问题原因]在编译时使用了预编译头文件, [解决方法]Project-->Pro ...

  9. 【Visual Studio】error: /ZI”和“/Gy-”命令行选项不兼容(转)

    原文转自 http://bbs.100home.net/view/4206.html [问题说明]vc6项目用vs2015打开时遇到的错误 [解决方法]项目属性->c/c++->常规-&g ...

随机推荐

  1. 穹举,迭代,while循环。

    所有循环  必要条件 :   初始条件(注意初始条件的位置)   循环条件   循环体   状态改变: 1.穷举 将所有可能性全部全部走一遍,使用IF筛选出满足的情况 使用循环语句    for   ...

  2. App主界面Tab实现方法

    ViewPager + FragmentPagerAdapter 这里模仿下微信APP界面的实现 国际惯例,先看下效果图:   activity_main.xml 布局文件: <?xml ver ...

  3. 【Excel 4.0 函数】REGISTER

    REGISTER.ID 返回指定的 DLL 或 代码资源注册过的函数 ID.如果 DLL 或 代码资源没有注册,这个函数将会注册它们,并返回 注册ID. REGISTER.ID 可以用于工作表(不同于 ...

  4. ERROR ITMS-90032 “Invalid image path”

    在用 Application Loader上传spa 文件的时候出现这样的错误:ERROR ITMS-90032: "Invalid image path No image found at ...

  5. 自定义Log模块

    BuildConfig.DEBUG默认为true,在为app打上SignedKeyStore之后就为false, // Log控制器 MyLoger.openDebutLog(true); MyLog ...

  6. 使用HttpWebRequest发送自定义POST请求

    平时用浏览器看网页的时候,点击一下submit按钮的时候其实就是给服务器发送了一个POST请求.但是如何在自己的C#程序里面实现类似的功能呢?本文给出了一个简单的范例,可以实现类似的和web serv ...

  7. 对Java内存模型即JMM的理解

    类似物理上的计算机系统,Java虚拟机规范中也定义了一种Java内存模型,即Java Memory Model(JMM),来屏蔽掉各种硬件和操作系统的内存访问差异,以实现让Java程序在各种平台下都能 ...

  8. 重温WCF之WCF中可靠性会话(十四)

    1.WCF中可靠性会话在绑定层保证消息只会被传输一次,并且保证消息之间的顺序.当使用TCP(Transmission Control Protocol,传输控制协议)通信时,协议本身保证了可靠性.然而 ...

  9. java中文乱码解决方法汇总

    public static void main(String[] argv){ try {                 System.out.println(“中文”);//1           ...

  10. [LeetCode] Word Break II (TLE)

    Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each ...