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.
postcss-font-grabber
Advanced tools
Grab remote font in @font-face, download it and update your CSS, end of story.
This is a PostCSS plugin, only do one thing:
Grab remote font in @font-face
, download it and update your CSS
.
Boom.
Before using:
@font-face {
font-family : 'beautiful-font';
src : url('https://font-site.com/beautiful-font.woff');
}
After using:
@font-face {
font-family : 'beautiful-font';
src : url('local-font/beautiful-font.woff');
}
And of cource, the beautiful-font.woff
file is in your local-font/
folder now.
gulp.task('css', function () {
var postcss = require('gulp-postcss');
var postcssFontGrabber = require('postcss-font-grabber');
return gulp.src('src/**/*.css')
.pipe(postcss([
postcssFontGrabber() // I'm here
]))
.pipe(gulp.dest('build/'));
});
Use postcss-loader:
import postcssFontGrabber from 'postcss-font-grabber';
module.exports = {
module: {
loaders: [
{
test: /\.css$/,
loader: "style-loader!css-loader!postcss-loader"
},
//
// Let Webpack support font file
//
{
test: /\.(svg|ttf|eot|woff|woff2)$/,
loader: 'file-loader'
}
]
},
postcss: () => {
return [
postcssFontGrabber() // I'm here
];
}
}
Function postcssFontGrabber
takes an object of options as parameter:
postcssFontGrabber({ dirPath: '../css/build/font/' })
Type: String
The folder to save font file to, it's the same folder as the output CSS
file is in by default.
Grab local file.
Rename font file name automatically (Configurable).
Just replace the rule, do not download the font file.
Licensed under the APACHE LISENCE 2.0.
FAQs
It grabs remote font files and update your CSS, just like that.
The npm package postcss-font-grabber receives a total of 1,567 weekly downloads. As such, postcss-font-grabber popularity was classified as popular.
We found that postcss-font-grabber 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.