Giter Site home page Giter Site logo

xelzs / code-size Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 53 KB

Estimates the size of your files in different format (original, minified, gzipped, brotli).

License: MIT License

JavaScript 100.00%
size-calculation sizes size-coding scss css tool minify gzip brotli estimation

code-size's Introduction

CodeSize

Maintainability

Estimates the size of your files in different format (original, minified, gzipped, brotli).

Command-line Usage

Install code-size package globally with npm :

$ npm install -g @xelzs/code-size

Basic usage :

$ code-size -f test.css -gbm --language css

CodeSize | Version 1.0.0

Original size : 9.11 KB
Minified size : 7.16 KB
Gzipped size : 140 Bytes
Brotli size : 82 Bytes

Available options :

Usage: code-size [options]

Options:
  -V, --version              output the version number
  -s, --source <code>        specify raw source code
  -f, --file <path>          specify path to a file
  -g, --gzip                 show gzipped size
  -b, --brotli               show brotli size
  -m, --minify               show minified size | !! Works only with supported language !!
  -l, --language <language>  specifies the language type. Supported: css, sass, scss, js (default: "css")
  -h, --help                 display help for command

Programmatic Usage

Install with npm :

$ npm install --save @xelzs/code-size

Get all sizes :

const {size} = require('code-size');

const data = size({
  file: 'test.css',
  gzip: true,
  brotli: true,
  minify: true,
  language: 'css',
});

console.log(data);
// {
//   original: '9.11 KB',
//   minify: '7.16 KB',
//   gzip: '140 Bytes',
//   brotli: '82 Bytes',
// }

Options

All options availables on command-line are also available here.

  • source - Raw source code
  • file - Path to a file
  • gzip - Boolean to enable the gzip estimation
  • brotli - Boolean to enable the brotli estimation
  • minify - Boolean to enable the minify estimation. Language option required
  • language - Specify the language type. Supported: css, sass, scss, js.

Changelog

Changelog is accessible in the CHANGELOG.md file or in the release section.

code-size's People

Contributors

xelzs avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

zaosoula

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.