【发布时间】:2016-09-22 07:26:40
【问题描述】:
我想将twitter-bootstrap 与inline-styles 一起使用,为此,我进行了设置:
{
test: /\.scss$/,
loaders: ['raw', 'inline-style', 'autoprefixer?' + autoprefixerOptions, 'sass']
}
我已经使用 npm 安装了 bootstrap-sass 和 radium。我写了这段代码:
import normalize from 'radium-normalize'
import m from '../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_mixins.scss'
import v from '../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_variables.scss'
import sc from '../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_scaffolding.scss'
import t from '../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_type.scss'
import buttons from '..//node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_buttons.scss'
我尝试将这些添加到radium 提供的Style 组件中,如下所示:
const baseRules = {...normalize, ...m, ...v, ...sc, ...type}
const App = () => (
<div>
<Style rules={baseRules} />
<HelloWorld />
</div>
)
我收到这些错误消息,通知我未定义变量和 mixin:
ERROR in ./~/bootstrap-sass/assets/stylesheets/bootstrap/_scaffolding.scss
Module build failed:
@include box-sizing(border-box);
^
No mixin named box-sizing
Backtrace:
stdin:12
in /home/vamsi/Do/webpack-npm-plugin/node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_scaffolding.scss (line 12, column 12)
@ ./src/index.js 21:19-107
ERROR in ./~/bootstrap-sass/assets/stylesheets/bootstrap/_type.scss
Module build failed:
font-family: $headings-font-family;
^
Undefined variable: "$headings-font-family".
in /home/vamsi/Do/webpack-npm-plugin/node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_type.scss (line 11, column 16)
@ ./src/index.js 25:12-93
ERROR in ./~/bootstrap-sass/assets/stylesheets/bootstrap/_buttons.scss
Module build failed:
font-weight: $btn-font-weight;
^
Undefined variable: "$btn-font-weight".
in /home/vamsi/Do/webpack-npm-plugin/node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_buttons.scss (line 12, column 16)
@ ./src/index.js 29:15-100
【问题讨论】:
标签: twitter-bootstrap reactjs sass webpack inline-styles