Last active
January 24, 2022 22:27
-
-
Save wtnabe/943868822140f3e75757b8e6492a02ab to your computer and use it in GitHub Desktop.
PostCSSからSass ( Scss ) を使う設定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = () => { | |
const plugins = [ | |
// Sass独自の _ スコア始まりのファイル名や glob 対応 | |
require('postcss-easy-import')({ | |
extensions: ['.css', '.scss'], | |
prefix: '_' | |
}), | |
// Sass独自の `//' コメントを削除 | |
require('postcss-strip-inline-comments'), | |
// Sassのコンパイル | |
require('csstools-postcss-sass-pre-release'), | |
// ブラウザの互換性確保 | |
require('postcss-preset-env')({ | |
autoprefixer: true | |
}) | |
] | |
// minify | |
if (process.env.NODE_ENV === 'production') { | |
plugins.push(require('postcss-csso')) | |
} | |
return { | |
// Sass記法をパースできるように | |
parser: 'postcss-scss', | |
plugins | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment