webpack에 새로 입했으나 현재 웹팩에서 사용하지 않을 문서 본문에 스타일을 삽입하고 있습니다. 나는 이것을 성취하는 방법을 잘 모른다. 당신이 아직도 내가 가지고있는 SCS들 파일과 일치하지 않습니다 CSS를 주입 볼 수 있듯이webpack에서 CSS/Autoprefixer가 작동하지 않음을 비활성화하십시오.
가 여기 내 webpack.config.js
입니다var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
output: {
filename: 'bundle.js'
},
entry: {
app: './js/app.js'
},
module: {
loaders: [
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({use:[{loader: 'css-loader', options: {importLoaders: 1}}, 'postcss-loader', 'sass-loader']})
}
]
},
plugins: [
new ExtractTextPlugin('styles.css'),
new webpack.LoaderOptionsPlugin({options: {
context: __dirname,
postcss: [
autoprefixer
]
}})
]
};
HTML 출력은
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="/wp-content/themes/index/styles.css">
<style type="text/css">
body {
background-color: black; }
h1 {
color: #fff; }
p {
display: flex;
color: #fff; }
</style>
<style type="text/css"></style>
</head>
<body>
<h1>Test</h1>
<p>Test</p>
<script src="/wp-content/themes/index/dist/bundle.js"></script>
</body>
</html>
입니다. 또한 flex 속성 접두어가 아니거나 내 sass 파일에있는 가져 오기를 포함하지 않습니다.
main.scss
@import 'test';
body {
background-color: black;
}
h1 {
color: #fff;
}
p {
display: flex;
color: #fff;
background-color: red;
}
_test.scss
구성으로 해결해야 할 세 가지 문제가 있습니다h2 {
color: blue;
}
Euuuh ... 당신은 scss loader 인 하나의 로더 만 가지고 있습니다 ... 정확히 무엇을 기대합니까? – briosheje