Skip to content

Instantly share code, notes, and snippets.

@maxfenton
Created May 1, 2023 19:15
Show Gist options
  • Save maxfenton/318a7760d8aea2a1d55afd607a3da760 to your computer and use it in GitHub Desktop.
Save maxfenton/318a7760d8aea2a1d55afd607a3da760 to your computer and use it in GitHub Desktop.
PostCSS config for a legacy SASS project
module.exports = {
parser: "postcss-scss",
plugins: [
require("postcss-easy-import")({ // Enables globs in @import. See style.css.
prefix: false,
skipDuplicates: false,
warnOnEmpty: false,
}),
require("postcss-advanced-variables"), // Sass-style @ vars, looping, and @import
require("postcss-custom-media"), // Custom reusable media queries
require("postcss-nested"), // Sass-style rule nesting
require("postcss-preset-env") ({ // Automatically polyfill modern CSS features
features: {
"nesting-rules": false, // disables CSS nesting in favor of Sass-style nesting (postcss-nested)
},
}),
require("postcss-pxtorem"), // Converts units to rems (defaults to only font properties @ 16px base size)
require("postcss-assets"), // Filename resolver for images
require('postcss-discard-comments'), // Removes all comments (/* */)
],
};
@maxfenton
Copy link
Author

Note that apparently there is a newly maintained fork of postcss-pxtorem at https://github.com/hemengke1997/postcss-pxtorem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment