Skip to content

The postcss plugin of iconsauce, a build tool to bundle only the icons used in your code.

License

Notifications You must be signed in to change notification settings

iconsauce/postcss-iconsauce

Repository files navigation

postcss-iconsauce

For more infos go to iconsauce docs.

Installation

To install iconsauce you'll need to run this command

npm i --save-dev @iconsauce/core postcss-iconsauce autoprefixer

PostCSS config

Place a postcss.config.js into the root of your project:

module.exports = {
  plugins: [
    require('postcss-iconsauce'),
    require('autoprefixer'),
  ],
}

CSS entry point

To let iconsauce builds, it needs a css entrypoint with a special at-rule inside:

@iconsauce;

/* You can also add more code for icons here */

At this point, how PostCSS is integrated in yout build system depends on the framework you are using, we will add more reproducible example as soon as possibile:

  • create-react-app
  • Next
  • Angular

PostCSS CLI

If you want to use iconsauce from CLI with PostCSS, install an additional dependency:

npm i --save-dev postcss-cli

Now you can add a script to build in your package.json file.

"scripts": {
  "build:iconsauce": "postcss src/styles/iconsauce.css -o public/styles/iconsauce.css"
}

About

The postcss plugin of iconsauce, a build tool to bundle only the icons used in your code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published