includePath 没有为我的导入语句提供我在节点 sass 中需要的东西



我正在使用javascript渲染函数来自动化node-sass构建,但是import语句仍然无法找到波旁威士忌和整洁。

渲染.js

var sass = require('node-sass');
var bourbon = require("bourbon").includePaths;
var neat = require("bourbon-neat").includePaths;
var fs = require("fs");
var paths = bourbon.concat(neat)
console.log(paths)

fs.writeFile("/tmp/test", "Hey there!", function(err) {
    if(err) {
        return console.log(err);
    }
    console.log("The file was saved!");
}); 
sass.render({
  file: './app.scss',
  includePaths: paths,
  outFile: 'app.css',
  sourceMap: true,
  outputStyle: 'compressed'
}, function(error, result) { // node-style callback from v3.0.0 onwards
  if (error) {
    console.log(error.status); // used to be "code" in v2x and below
    console.log(error.column);
    console.log(error.message);
    console.log(error.line);
  }
  else {
    fs.writeFile("app.css", result.css.toString(), function (err) {
      if(err) {
          return console.log(err);
      }
      console.log("The file was saved!");
      fs.writeFile("app.css.map", result.map.toString(), function (err) {
        if(err) {
            return console.log(err);
        }
        console.log("The file was saved!");
      })
    })
    console.log(result.stats);
    console.log(result.map.toString());
    // or better
    console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too
  }
});

app.scss

@import "bourbon";
@import "neat";
@import 'base/index';

和控制台输出/错误:

c:MedLeverMedLeverStyles>node render
[ 'c:\MedLever\MedLever\Styles\node_modules\bourbon\app\assets\stylesheets',
  'c:\MedLever\MedLever\Styles\node_modules\bourbon-neat\app\assets\stylesheets' ]
{ Error: ENOENT: no such file or directory, open 'c:tmptest'
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'c:\tmp\test' }
1
13
no mixin named grid-media
Backtrace:
        base/_header.scss:20
20

我错过了什么? includePath 应该告诉导入状态在哪里查找,但它似乎忽略了它。

FFS -- includePath 工作正常,Neat 2.0 还没有在 npm 上。

相关内容

  • 没有找到相关文章

最新更新