https://github.com/cnlon/less-plugin-trim-font-face
Trim useless font formats in `@font-face`
https://github.com/cnlon/less-plugin-trim-font-face
font-face font-formats less less-plugin trim
Last synced: 3 months ago
JSON representation
Trim useless font formats in `@font-face`
- Host: GitHub
- URL: https://github.com/cnlon/less-plugin-trim-font-face
- Owner: cnlon
- License: mit
- Created: 2018-05-07T10:56:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-25T07:21:12.000Z (over 6 years ago)
- Last Synced: 2024-04-26T19:47:10.182Z (about 1 year ago)
- Topics: font-face, font-formats, less, less-plugin, trim
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# less-plugin-trim-font-face
[](https://badge.fury.io/js/less-plugin-trim-font-face)
[](http://standardjs.com)Trim useless formats in `@font-face` of Less files. Compatible with Less v2 and v3.
# Promgrammatic usage
```javascript
const TrimFontFace = require('less-plugin-trim-font-face')less.render('You less source', {
plugins: [
new TrimFontFace({
'iconfont': ['woff']
})
]
})
```It will trim useless font formats but `woff` if `font-family` is `iconfont` in `@font-face` directives.
For example. If your less source like:
```less
@font-face {
font-family: "iconfont";
src: url('/fonts/iconfont.eot?t=1522658144332');
src: url('/fonts/iconfont.eot?t=1522658144332#iefix') format('embedded-opentype'),
url('/fonts/iconfont.woff') format('woff'),
url('iconfont.ttf?t=1522658144332') format('truetype'),
url('iconfont.svg?t=1522658144332#iconfont') format('svg');
}
```You will get output:
```less
@font-face {
font-family: "iconfont";
src: url('/fonts/iconfont.woff') format('woff');
}
```***
MIT