Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Last active January 24, 2022 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtnabe/943868822140f3e75757b8e6492a02ab to your computer and use it in GitHub Desktop.
Save wtnabe/943868822140f3e75757b8e6492a02ab to your computer and use it in GitHub Desktop.
PostCSSからSass ( Scss ) を使う設定
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