Im sau instrtuctions trên the bootstrap-sass-loader pageKhông thể có được bootstrap-sass để làm việc với webpack
trong package.json của tôi, tôi đã
"bootstrap-sass": "^3.3.6",
"bootstrap-sass-loader": "^1.0.9"
đây là webpack.config.js tôi
module.exports = {
entry: ['./app.js'],
output: {
publicPath: 'http://localhost:8080/',
filename: 'build/bundle.js'
},
devtool: 'eval',
module: {
/* used on code before it's transformed */
preLoaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'source-map'
}
],
/* used to modify code */
loaders: [
{test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery'},
{test: /\.obj|\.mtl|\.html|\.dae|\.txt/, loader: "raw"},
{test: /\.jsx?$/, exclude: /(node_modules)/, loader: 'babel'},
{test: /\.css$/, loader: 'style-loader!css-loader'},
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file"},
{test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff'},
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream"},
{test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml"},
{
test: /\.scss$/,
/* order from bottom to top, so first sass, autoprefix, css and finally style */
loaders: ['style', 'css', 'autoprefixer?browsers=last 3 versions', 'sass?outputStyle=expanded']
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: ['url?limit=8192', 'img']
},
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel'
}
],
/* used to modify generated code */
postLoader: []
}
};
theo như tôi hiểu tôi chỉ cần sử dụng
require("bootstrap-sass-loader");
trong số app.js
và hoàn tất. nhưng tôi không thể sử dụng bất kỳ kiểu bootstrap nào. tôi đang thiếu gì ở đây?
Bạn nói: "Sau đó chỉ cần nhập hai trong sass/file SCSS của bạn". Làm thế nào để bạn bao gồm/nhập "của bạn" sass/scss tập tin? – Luke
Xin lỗi, tôi nhận thấy "của bạn" không phải là giải thích đặc biệt. Tôi đã chỉnh sửa câu trả lời của mình. Tôi có nghĩa là phong cách của thành phần – cortopy
Tôi nhận được một tá trong số này 'Lỗi trong ./~/bootstrap-sass/assets/javascripts/...' 'Mô-đun không tìm thấy: 'jquery' trong/home ...' – OlehZiniak