Helpful Human's PostCSS Presets
This library provides a default set of PostCSS plugins and configurations based on the internal standards employed at Helpful Human.
npm install --save-dev @helpfulhuman/postcss-preset
buildConfig() method allows you to quickly create the entire config needed for PostCSS.
Standard PostCSS Config
If you're using PostCSS directly with
postcss-cli command line tool, you can create a
postcss.config.js file and export the results of the
buildConfig() method. This approach is likely the best solution for adding PostCSS support to codebases where modern tools like Webpack are not available or not needed.
Note: The postcss-partial-import plugin is added when using the default
buildMode. This means you can use
@importwith relative filepaths or globs to include files in your bundled CSS, like you would with SASS or Stylus.
var preset = ;// no arguments are requiredmoduleexports = preset;
Now you can use the
postcss command line utility to build your CSS.
postcss src/index.css --map --output public/main.css
Alternatively, if you're in a situation where you don't need a full configuration for PostCSS, you can get an array of just the configured plugins using the
buildConfig()invokes this function under the hood.
var preset = ;var plugins = preset;
||Enables the autoreset plugin when when set to
||An array of strings used for automatically adding vendor prefixes. See autoprefixer's
||Enables the use of short rule notation when set to
||Enables broadstroke legacy browser support (like IE9) when set to
||Must be set to a value of
||Optimizes the final output for production releases. Defaults to
||Enable various preprocessor features by providing an array of features to enable. Defaults to all options:
||Provides single colon fallbacks for
||Helps support older browsers by automatically adding a
||Provide an object literal of variables to be injected and made globally available in your stylesheets.|
Warning: It is recommended that you don't touch these unless absolutely necessary.
Not listed in the options table above is the
$sudo field that allows you to manually provide configurations to each individual plugin used by this library. Along with the standard options that each plugin supports individually, a
forceEnable feature is also available to ensure that the plugin is included with your configuration (despite the settings above).
var preset = ;moduleexports = preset;
Below is a list of all of the plugins you can configure and their corresponding key name.