All Projects → ahmadnassri → metalsmith-imagemin

ahmadnassri / metalsmith-imagemin

Licence: MIT license
Metalsmith plugin to minify images

Programming Languages

javascript
184084 projects - #8 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to metalsmith-imagemin

metalsmith-paths
Metalsmith plugin that adds file path values to metadata
Stars: ✭ 19 (+11.76%)
Mutual labels:  lib, metalsmith
metalsmith-request
Metalsmith plugin to grab content from the web and expose the results to metadata
Stars: ✭ 12 (-29.41%)
Mutual labels:  lib, metalsmith
Xtd forms
Modern c++17 library to create native gui for Microsoft Windows, Apple macOS and Linux.
Stars: ✭ 25 (+47.06%)
Mutual labels:  lib
impromptu.nvim
Create prompts fast and easy
Stars: ✭ 39 (+129.41%)
Mutual labels:  lib
Notion Js
🤯 Notion API
Stars: ✭ 136 (+700%)
Mutual labels:  lib
Imageselector
图片选择器, 支持多图选择和图片预览
Stars: ✭ 62 (+264.71%)
Mutual labels:  lib
Weworkapi php
official lib of wework api
Stars: ✭ 225 (+1223.53%)
Mutual labels:  lib
M3u8
Parser and generator of M3U8-playlists for Apple HLS. Library for Go language. 🎦
Stars: ✭ 800 (+4605.88%)
Mutual labels:  lib
tgcalls
Voice chats, private incoming and outgoing calls in Telegram for Developers
Stars: ✭ 408 (+2300%)
Mutual labels:  lib
Vue Loaders
Vue + loaders.css
Stars: ✭ 127 (+647.06%)
Mutual labels:  lib
rawhttp
Raw HTTP client in Go for complete request control and customization.
Stars: ✭ 100 (+488.24%)
Mutual labels:  lib
Math Engine
Mathematical expression parsing and calculation engine library. 数学表达式解析计算引擎库
Stars: ✭ 123 (+623.53%)
Mutual labels:  lib
Appmetrics.js
A small (< 1kb) library for measuring things in your web app and reporting the results to Google Analytics.
Stars: ✭ 1,383 (+8035.29%)
Mutual labels:  lib
Stdlib
✨ Standard library for JavaScript and Node.js. ✨
Stars: ✭ 2,749 (+16070.59%)
Mutual labels:  lib
Easygo
基于Kotlin、OkHttp的声明式网络框架,像写HTML界面一样写网络调用代码
Stars: ✭ 40 (+135.29%)
Mutual labels:  lib
Mal4J
Java wrapper for the official MyAnimeList API
Stars: ✭ 23 (+35.29%)
Mutual labels:  lib
Node Pretty Exceptions
Pretty and more helpful uncaught exceptions, automatically
Stars: ✭ 22 (+29.41%)
Mutual labels:  lib
Dtkwidget
Deepin Toolkit, widget module for DDE look and feel
Stars: ✭ 112 (+558.82%)
Mutual labels:  lib
React Scoped Css
CSS encapsulation solution for React
Stars: ✭ 214 (+1158.82%)
Mutual labels:  lib
remove
A Metalsmith plugin to remove files from the build
Stars: ✭ 19 (+11.76%)
Mutual labels:  metalsmith

Metalsmith Imagemin

Metalsmith plugin to minify images.

license release semantic

Install

npm install metalsmith-imagemin

Available plugins

imagemin-advpng
imagemin-giflossy
imagemin-gifsicle
imagemin-gm
imagemin-jpegoptim
imagemin-jpeg-recompress
imagemin-jpegtran
imagemin-mozjpeg
imagemin-optipng
imagemin-pngcrush
imagemin-pngout
imagemin-pngquant
imagemin-svgo
imagemin-webp
imagemin-zopfli

API

Pass options to the imagemin plugin and pass it to Metalsmith with the use method:

const Metalsmith = require('metalsmith')
const imagemin = require('metalsmith-imagemin')

const metalsmith = new Metalsmith(__dirname)
  .use(imagemin({
    optimizationLevel: 3,
    svgoPlugins: [{ removeViewBox: false }]
  }))

To configure plugin

Default jpegrecompress options will be overwritten:

const Metalsmith = require('metalsmith')
const imagemin = require('metalsmith-imagemin')

const metalsmith = new Metalsmith(__dirname)
  .use(imagemin({
    optimizationLevel: 3,
    svgoPlugins: [{ removeViewBox: false }],

    jpegrecompress: { quality: 'veryhigh' }
  }))

To disable/replace a default plugin

By default there are 4 plugins enabled:

gifsicle
jpegrecompress
pngquant
svgo

To disable a default plugin use pluginname: null, to disable ALL the default plugins use: disableDefaults: true

E.g. disable default jpegrecompress and replace it with another plugin (mozjpeg):

const Metalsmith = require('metalsmith')
const imagemin = require('metalsmith-imagemin')

const metalsmith = new Metalsmith(__dirname)
  .use(imagemin({
    optimizationLevel: 3,
    svgoPlugins: [{ removeViewBox: false }],

    jpegrecompress: null,
    mozjpeg: {}
  }))

CLI

You can also use the plugin with the Metalsmith CLI by adding metalsmith-imagemin key to your metalsmith.json plugins with any imagemin options you want, like so:

{
  "plugins": {
    "metalsmith-imagemin": {
      "optimizationLevel": 3,
      "svgoPlugins": [{
        "removeViewBox": false
      }]
    }
  }
}

Author: Ahmad Nassri • Twitter: @AhmadNassri

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].