samsaraA 2018. 7. 8. 22:40


PostCSS :

scss를 css로 바꾸기


.postcssrc 파일 생성

{
"modules": true
}


postcss를 설치

yarn add postcss-modules
yarn global add node-sass



src/styles.scss 생성

.title{
color: blue;
}


App.js에 scss파일 import

import React from "react";
import styles from "./styles.scss";

export default () => <div className={styles.title}>Test!</div>;




scss가 css로 잘 변환된 걸 볼 수 있다




auto prefixer


webkit, moz, ms...등을 자동으로 생성하는 플러그인


먼저, 설치

yarn add autoprefixer



.postcssrc 수정

어떤 브라우저를 호환할건지 설정해준다

{
"modules": true,
"plugins":{
"autoprefixer":{
"browsers":[
"> 1%",
"Last 2 versions",
"IE 10"
]
}
}
}