Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
webfonts-loader
Advanced tools
A WebPack loader to automaticaly generate font files and CSS to make your own icon font
A loader that generates fonts from your SVG icons and allows you to use your icons in your HTML.
webfonts-loader
uses the webfonts-generator
plugin to create fonts in any format. It also generates CSS files so that you can use your icons directly in your HTML, using CSS classes.
npm install webfonts-loader
An example of usage can be found in the test/
directory of this repository.
Add this rule to your Webpack config:
{
test: /\.font\.js/,
loader: ExtractTextPlugin.extract({
use: [
'style-loader',
'css-loader',
'webfonts-loader'
]
})
}
So that each font configuration file will be loaded using this rule.
The config file allows you to specify parameters for the loader to use. Here is an example configuration file:
// myfont.font.js
module.exports = {
'files': [
'./myfont/*.svg'
],
'fontName': 'myfonticons',
'classPrefix': 'myfonticon-',
'baseSelector': '.myfonticon',
'types': ['eot', 'woff', 'woff2', 'ttf', 'svg'],
'fileName': 'app.[fontname].[hash].[ext]'
};
Then you have to require the configuration file:
// entry.js
require('./myfont.font');
The loader will then generate:
baseSelector
, StringThe base CSS selector, under which each icon class is to be created. See webfonts-generator#templateoptions
classPrefix
, StringThe prefix to be used with each icon class. See webfonts-generator#templateoptions
cssTemplate
, StringSee webfonts-generator#csstemplate
embed
, BooleanIf true the font is encoded in base64 and embedded inside the @font-face
declaration, otherwise font files are written to disk.
Default: false
hashLength
, NumberOptional. The length of hash in fileName
.
Min: 8
Max: 32
Default: 20
fileName
, StringThe generated font file names. These elements can be used:
[fontname]
: the value of the fontName
parameter[ext]
: the extension of the font file being generated (eot
, ...)[hash]
: the hash of the current compilation[chunkhash]
: the hash of the SVG filesfiles
, ArrayfontName
, StringSee webfonts-generator#fontname
formatOptions
, ObjectSee webfonts-generator#formatoptions
rename
, Functiontypes
, ArrayFAQs
A WebPack loader to automatically generate font files and CSS to make your own icon font
The npm package webfonts-loader receives a total of 9,632 weekly downloads. As such, webfonts-loader popularity was classified as popular.
We found that webfonts-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.