Nonstop Progressive Marxism
    Have ideas to improve npm?Join in the discussion! »

    arjan-optimize

    0.6.6 • Public • Published
    Arjan Localize

    License Build Status

    Arjan Optimize

    Intro

    Arjan Optimize helps you optimize all of your static assets with a single command. It takes into account several of the modern web dev directives and uses some of the most popular node modules for minification/compression of assets with a couple of neat features of its own. For more info read the docs

    How it works

    Arjan optimize scans your current directory recursively and for each file with a different module depending on the files MIME type. Arjan Optimize uses:

    Formats supported

    Input Module used Output options reason used
    html html-minifier html options best compression
    css csso css options best overall size+speed+compression
    js terser js Parse, Compress, Mangle support for ES6, best speed & compression
    svg svgo svg options most widely used open source option
    jpeg sharp jpeg options fastest option
    png sharp png options fastest option
    webp sharp webp options fastest option
    gif sharp png options fastest option
    tiff sharp tiff options fastest option

    Webp Images

    The webp option in Arjan Optimize does 2 things:

    1. converts all your images to webp using sharp and saves them (without overwritting images in original format)
    2. In the HTML files, it replaces each img tag with a picture tag that holds both its original compressed version and its webp version.

    Because webp is a relatively new format, it is not supported by all browsers. The picture tag is a solution that allows unsupported browsers to fall back to the original version of the image. This article goes more in depth on webp and the picture tag.

    suppose we have the following image tag:

    <img src="img/arjan-logo.png" class="img-fluid">
    

    this will be replaced by:

    <picture>
      <source type="image/webp" srcset="img/arjan-logo.png">
      <source type="image/png" srcset="img/arjan-logo.png">
      <img src="img/arjan-logo.png" class="img-fluid">
    </picture>
    

    CLI command

    arjan optimize SITENAME [FILENAME] --img --webp --responsive --html --css --rcss --js

    USAGE
      $ arjan optimize [FILENAME]
    
    ARGUMENTS
      FILENAME  name of the file i.e. index.html
    
    OPTIONS
      -c, --css     minifiy css using cssnano
      -h, --html    compress html using html-minifier
      -i, --images  compress images and if possible maintain the format, otherwise its converted to png.
      -j, --js      minify js using uglify js
    
      -w, --webp    saves a webp version of each image, then replaces each image instance in the html files with a picture tag.
    

    ## Programmatic usage

    For more info read the docs

    Install

    npm i arjan-optimize

    DownloadsWeekly Downloads

    1

    Version

    0.6.6

    License

    MIT

    Unpacked Size

    19.2 kB

    Total Files

    15

    Last publish

    Collaborators

    • avatar