Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
metalsmith-gzip
Advanced tools
Changelog
2.0.0 ##
Readme
A Metalsmith plugin that creates gzipped copies of the site's content. This is useful for website hosting on Amazon S3, where on the fly compression in the server is impossible.
$ npm install metalsmith-gzip
var Metalsmith = require('metalsmith');
var compress = require('metalsmith-gzip');
var metalsmith = new Metalsmith(__dirname)
.use(compress());
metalsmith-gzip
will gzip a file if the extension matches this regular expression:
/\.[html|css|js|json|xml|svg|txt]/
The choice of files to compress is loosely based on the HTML5 Boilerplate server configuration.
Pass an options object to customize metalsmith-gzip behaviour. These are the available options keys:
src
is a multimatch pattern which specifies which types of files to compress.
var metalsmith = new Metalsmith(__dirname)
.use(compress({src: ['**/*.js', '**/*.css']})); // only compresses JavaScript and CSS
gzip
is the same configuration object accepted by zlib.createGzip
(http://nodejs.org/api/zlib.html#zlib_options). For example, you can set the compression level:
var metalsmith = new Metalsmith(__dirname)
.use(compress({
src: ['**/*.js', '**/*.css'],
gzip: {level: 6}
}));
Add overwrite: true
to replace files with the compressed version instead of creating a copy with the '.gz' extension:
var metalsmith = new Metalsmith(__dirname)
.use(compress({overwrite: true});
You need to create a script to upload the gzipped versions of the files to your preferred hosting provider yourself. Take care to serve the files with the correct Content-Encoding.
This plugin was inspired by the Middleman gzip extension.
FAQs
A Metalsmith plugin to compress build files with gzip.
The npm package metalsmith-gzip receives a total of 34 weekly downloads. As such, metalsmith-gzip popularity was classified as not popular.
We found that metalsmith-gzip demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.