css - 我无法在元素中使用node-bourbon

标签 css node.js sass angular bourbon

我尝试使用npm模块来处理scss文件。波旁节。
我得到以下错误:

  with: function() {
var paths  = Array.prototype.slice.call(arguments);
return [].concat.apply([bourbon.includePaths], paths);
}
};

  Invalid CSS after "v": expected 1 selector or at-rule, was "var path =   require("
  in C:\Users\gwk736\GitLab\Inform\node_modules\node-bourbon\index.js (line   1, column 1)
@ ./src/app/header/header.component.ts 20:21-55

我的SCSS第一行:
@import "~node-bourbon";

我的组件:
import { Component } from 'angular2/core';

@Component({
selector: 'header',
template: require('./header.component.html'),
styles: [ require('./header.component.scss') ]
})
export class HeaderComponent {
headerTitle: string = 'title';
}

最佳答案

假设您使用的是webpack,那么您应该对scss使用loader,比如sass-loaderhttps://github.com/jtangelder/sass-loader)。
检查此项目:https://github.com/fraserxu/webpack-bourbon-test

关于css - 我无法在元素中使用node-bourbon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36914448/

相关文章:

node.js - Express app.locals 是否在请求之间共享?

node.js - 如何集成 Koa、Passport 和 MongoDB?

sass - 为什么 grunt-contrib-compass 有一个 javascriptsDir 参数?

html - 层的奇怪 css 行为

javascript - 滚动显示 'no elements found' ?

javascript - 将变量传递给 promise 的函数

sass - 将列表元素作为参数传递给混入

sass - 如何在 Sass 映射的循环中获取键、值和索引号?

php - Twitter Bootstrap : Input-append Search Box

javascript - 获取 HTML 属性中 CSS 声明的值