postcss-icon
PostCSS plugin that adds css icons
from Icon sets
Now you do not need to connect the entire style library for css icons.
Ison sets:
Font icons:
Css only icons:
Install for postcss
npm install --save-dev postcss-icon
npm install --save-dev postcss-icon.material-design
npm install --save-dev postcss-icon.font-awesome-v4
npm install --save-dev postcss-icon.cssicon
npm install --save-dev postcss-icon.icono
npm install --save-dev postcss-icon.rosa
npm install --save-dev postcss-icon.airpwn
npm install --save-dev postcss-icon.stiffi
npm install --save-dev postcss-icon.joshnh
Input:
.icon.bad-name{
@icon: 404-not-found-name;
}
.icon{
color: gold;
@icon: prefix-name;
}
Output:
@font-face { }
.icon.bad-name{
}
.icon::after{
content: '';
}
.icon{
color: #000;
width: 20px;
heigth: 20px;
color: gold;
}
const { resolve } = require('path');
const postcss = require('postcss');
const postcssIcon = require('postcss-icon');
const fontSetOptions = {
inline: ["woff2"],
path: resolve(__dirname, "./public/assets/fonts/"),
formats: ["woff2", "woff" ],
filename: "[css-name]-[set-name].[hash:4].[ext]",
url({ cssFile, fontName, hash }) {
return fontName;
}
};
postcss(
postcssIcon({
"postcss-icon.material-design": {
...fontSetOptions,
prefix: 'md-'
},
"postcss-icon.font-awesome-v4": {
...fontSetOptions,
prefix: 'fa-'
},
"postcss-icon.cssicon": { prefix: 'cssicon-' },
"postcss-icon.icono": { prefix: 'icono-' },
"postcss-icon.rosa": { prefix: 'rose-' },
"postcss-icon.airpwn": { prefix: 'airpwn-' },
"postcss-icon.stiffi": { prefix: 'stiffi-' },
"postcss-icon.joshnh": { prefix: 'joshnh-' }
})
);
Options
Formats Support table (2018-1-15):