0
다음과 같이 EventInfoCard를 구성합니다. 프리 로딩 상태에있을 때 부모로부터 많은 CSS를 상속받는 다른 구성 요소를 렌더링합니다. 나는 postcss-cssnext
변수를 사용하고 있는데이 함수는 css-loader
과 잘 작동하지 않습니다. css-loader breaking postcss-cssnext variables
@import '../constants.css';
.root {
background: blue;
}
.thumbnail {
composes: thumbnail from './InfoCard.css';
background-color: var(--tones-lightest);
}
.description {
composes: description from './InfoCard.css';
}
지금은 보이지만
EventInfoCardPreloading.css
@import '../constants.css';
.root {
}
.thumbnail {
display: block;
width: 100%;
height: 0px;
padding-bottom: 56%;
position: relative;
overflow: hidden;
border-radius: var(--xxxs)px;
}
.notification {
border-radius: var(--xxxs)px;
font-size: 12px;
display: inline-block;
height: var(--s)px;
padding: 0 var(--xxs)px;
line-height: var(--s)px;
text-transform: uppercase;
font-weight: var(--weight-medium);
margin-right: var(--xxs)px;
}
.description {
letter-spacing: -0.1px;
margin-top: 7px;
}
EventInfoCard.css
postcss의 설정 :
const path = require('path')
module.exports = {
plugins: {
'postcss-partial-import': {},
'postcss-mixins': {
mixinsDir: path.join(__dirname, 'statics', 'mycujoo-theme', 'mixins')
},
'postcss-nested': {},
'postcss-cssnext': {
browsers: ['last 2 versions', '> 5%'],
}
}
}
웹팩 로더 설정 : 구성 이후
test: /\.css$/,
use: extractCSS.extract({
fallback: 'style-loader',
use: [
{ loader: 'css-loader', options: { modules: true, localIdentName: '[name]__[local]___[hash:base64:5]' } },
{ loader: 'postcss-loader' }
]
}),