简要记录一下在使用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. 【HTTP】WireShark中获取Content-Encoding: gzip时的响应内容

    GZIP格式 详见:http://blog.csdn.net/jison_r_wang/article/details/52068607 表述的很清楚 关键:GZIP头以0x1F8B开始 用WireS ...

  2. 后台弹出JS类

    using System; using System.Collections.Generic; using System.Text; using System.Web; using System.We ...

  3. HTML标记之a标签

    一.a标签的语法 <a href=”链接目标地址” title=”注释” target=”打开链接窗口的形式”>链接显示内容</a> target值: _blank在新窗口中打 ...

  4. supersr--时间显示逻辑-->NSDate+NSCalendar

    一种:时间逻辑: - (NSString *)created_at{ //    从后台返回的字符串格式:Mon Aug 03 09:17:31 +0800 2014, //NSDateFormatt ...

  5. mongodb配置文件.conf

    启动方式 ./bin/mongod -f MongoDB.conf 会看到 about to fork child process, waiting until server is ready for ...

  6. ui组件--弹出层layer的使用

    帮助文档 下载地址 演示地址

  7. oracle dataguard (一)

    一.什么是data guard及data guard的工作原理 Data Guard 是一个集合,由一个primary数据库(生产数据库)及一个或多个standby数据库(最多9个)组成.组成Data ...

  8. 内核中用于数据接收的结构体struct msghdr(转)

    内核中用于数据接收的结构体struct msghdr(转) 我们从一个实际的数据包发送的例子入手,来看看其发送的具体流程,以及过程中涉及到的相关数据结构.在我们的虚拟机上发送icmp回显请求包,pin ...

  9. IOS管理文件和目录NSFileManager

    1.常见的NSFileManager文件方法 -(NSData *)contentsAtPath:path //从一个文件读取数据 -(BOOL)createFileAtPath: path cont ...

  10. Linux 通过os进程pid找到端口号

    [root@xxxx conf]# netstat -lutpn|grep tcp /java tcp /java tcp /java tomcat 监听的一些端口