
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
gatsby-plugin-zopfli
Advanced tools
Gatsby plugin for preparing zopfli-compressed gzip versions of assets.
The Zopfli Compression Algorithm is a new, open sourced data compression library. It creates a smaller output size, typically 3–8% smaller compared to zlib at maximum compression
The compression method is best suited for static web content, files that don't change that often and that generate a lot of traffic. That's because Zopfli uses two to three times more CPU time than zlib at maximum quality.
Files compressed with Zopfli can be decompressed with existing methods on the client and there will be no performance penalty at this end.
/webpack-runtime-cde5506958f1afc4d89e.js
becomes
/webpack-runtime-cde5506958f1afc4d89e.js.gz
This plugin wil only generate the compressed files. To see them been served to the client, your Gatsby website should run on a production server that supports GZip. The Gatsby development server does not serve the compressed versions.
With npm:
npm install --save gatsby-plugin-zopfli
Or with Yarn:
yarn add gatsby-plugin-zopfli
In your gatsby-config.js
file add:
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-zopfli'
}
]
}
By default, only .css
and .js
files are compressed, but you can override this with the extensions
option.
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-zopfli',
options: {
extensions: ['css', 'html', 'js', 'svg']
}
}
]
}
You can even place all the zopfli-compressed files in a dedicated directory (ex. public/zopfli
):
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-zopfli',
options: {
path: 'zopfli'
}
}
]
}
To customize compression, you can add optional parameters to the zopfli library: (see here for details on various options)
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-zopfli',
options: {
path: 'zopfli',
compression: {
numiterations: 25
}
}
}
]
}
For diagnostic information, you can enable verbose logging:
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-zopfli',
options: {
verbose: true
}
}
]
}
If you would like to help out with some code, check the details.
Not a coder, but still want to support? Have a look at the options available to donate.
Licensed under MIT.
NOTE: This plugin only generates output when run in production
mode!
FAQs
Gatsby plugin for preparing zopfli-compressed versions of assets
The npm package gatsby-plugin-zopfli receives a total of 2,587 weekly downloads. As such, gatsby-plugin-zopfli popularity was classified as popular.
We found that gatsby-plugin-zopfli 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 researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.