1
我已經安裝了引導用與reactjs不加引導班引導SCSS
npm install [email protected] --save
在我的依賴
我:
"dependencies": {
"bootstrap": "^4.0.0-alpha.6",
"react": "^15.6.1",
"react-dom": "^15.6.1"
}
在我styles.scss
@import '~bootstrap/scss/bootstrap';
和這裏是我的webpack文件:
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
inject: 'body'
})
module.exports = {
entry: './src/index.js',
output: {
path: __dirname + '/dist',
filename: 'build.js'
},
devServer: {
historyApiFallback: true
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/ },
{
test: /\.scss$/,
use: [
'style-loader',
'css-loader?importLoaders=1&modules&localIdentName=[name]_[local]_[hash:base64:5]',
'sass-loader',
],
}
]
},
plugins: [HtmlWebpackPluginConfig]
}
,但是當我在我的頭組件
import React from 'react';
export class Header extends React.Component {
render() {
return(
<header className="container">header here</header>
);
}
}
export default Header;
添加container
類,它看起來像這樣:
和build.js
我找不到.container
類。 .row
以及等
內bootstrap.scss>>import grid
容器會這樣:
@if $enable-grid-classes {
.container {
@include make-container();
@include make-container-max-widths();
}
}
和_variables.scss
內引導這個變量爲真
$enable-grid-classes: true !default;
這樣有什麼不對?