hasmin: "A CSS Minifier"

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

A CSS minifier which not only aims at reducing the amount of bytes of the output, but also at improving gzip compression. By default, the output is the minified CSS file, but hasmin allows also its compression into gzip using Google's Zopfli library.

To use it: ./hasmin input.css > output.css

By default, most minification techniques are enabled. For a list of available flags, do: ./hasmin --help


[Skip to Readme]

Properties

Versions 0.3.0.1, 0.3.0.1, 0.3.1.3, 0.3.2, 0.3.2.1, 0.3.2.2, 0.3.2.3, 0.3.2.4, 0.3.3, 0.3.3.1, 1.0, 1.0.1, 1.0.2, 1.0.2.1, 1.0.3
Change log None available
Dependencies attoparsec (>=0.12 && <0.14), base (>=4.8 && <5.1), bytestring (>=0.10.2.0 && <0.11), containers (>=0.5 && <0.6), gitrev (>=1.0.0 && <=1.2.0), hasmin, hopfli (>=0.2 && <0.3), mainland-pretty (>=0.4.1 && <0.5), matrix (>=0.3.4 && <0.4), mtl (>=2.2.1 && <2.3), numbers (>=3000.2.0.0 && <3000.3), optparse-applicative (>=0.11 && <0.14), parsers (>=0.12.3 && <0.13), semigroups (>=0.16 && <0.19), text (>=1.2 && <1.3) [details]
License BSD-3-Clause
Author (c) 2017 Cristian Adrián Ontivero <cristianontivero@gmail.com>
Maintainer Cristian Adrián Ontivero <cristianontivero@gmail.com>
Category Text
Home page https://github.com/contivero/hasmin/
Bug tracker https://github.com/contivero/hasmin/issues
Source repo head: git clone https://github.com/contivero/hasmin.git
Uploaded by contivero at 2017-02-24T17:03:53Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hasmin-0.3.0.1

[back to package description]

Hasmin - A Haskell CSS Minifier

Build Status License

Hasmin is a CSS minifier. To use it as a library, refer to the Hasmin module documentation.

Aside from the usual techniques (e.g. whitespace removal, color minification, etc.), the idea was to explore new possibilities, by implementing things other minifiers weren't doing, or they were, but not taking full advantage of.

Also, the minifier implements some techniques that do nothing for minified sizes, but attempt to improve post-compression sizes (at least when using DEFLATE, i.e. gzip).

For a list of techniques, see Minification Techniques.

Building

To compile, just run stack build.

Minifier Usage

Hasmin expects a path to the CSS file, and outputs the minified result to stdout.

Every technique is enabled by default, except for:

  1. Escaped character conversions (e.g. converting \2714 to , which can be enabled with --convert-escaped-characters)
  2. Dimension minifications (e.g. converting 12px to 9pt, which can be enabled with --dimension-min, or just -d)

These two are disabled mainly because they are—on average, not always—detrimental for DEFLATE compression. When something needs to be disabled, use the appropriate flag. Not every technique can be toggled yet, but a good amount of them allow it.

Note: there is a problem in Windows when using the --convert-escaped-characters flag to enable the conversion of escaped characters. A workaround is changing the code page, which can be done by running chcp 65001 in the terminal (whether cmd, or cygwin).

Zopfli Integration

Hasmin uses bindings to Google's Zopfli library, allowing the possibility to compress the result.

Since the output is a gzip file, it can be used for the web. It tipically produces files 3~8% smaller than zlib, at the cost of being around 80 times slower, so it is only a good idea if you don't need compression on the fly.

Zopfli is released under the Apache License, Version 2.0.