Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
CSSO (CSS Optimizer) is a CSS minifier. It performs three kinds of optimizations: structural optimizations, reducing CSS size by merging blocks with identical properties, removing overridden properties, etc.; cleaning (removing unused @media rules, cutting out the comments, etc.); and compressing (transforming values to shorter forms, merging identical selectors, etc.). It can be used as a command-line tool or as a library.
Minification
Minifies CSS by removing whitespace, comments, and making other optimizations to reduce file size.
const csso = require('csso');
const minifiedCss = csso.minify('.test { color: #ff0000; }').css;
Structural Optimization
Optimizes CSS structure by merging blocks with identical properties and removing overridden properties.
const csso = require('csso');
const optimizedCss = csso.minify('.test { color: red; } .test { font-size: 16px; }', { restructure: true }).css;
Source Map Generation
Generates a source map that can be used to debug the minified CSS by mapping it back to the original sources.
const csso = require('csso');
const result = csso.minify('.test { color: red; }', { sourceMap: true });
const minifiedCss = result.css;
const map = result.map.toString();
clean-css is a fast and efficient CSS optimizer for Node.js and the Web. It provides similar minification capabilities as CSSO but also offers advanced optimizations like restructuring.
uglifycss is a CSS minifier that aims to be fast and simple. It doesn't have as many features as CSSO, focusing mainly on removing whitespace and comments to compress CSS files.
purifycss is a tool to remove unused CSS. Unlike CSSO, which focuses on optimizing existing CSS, purifycss analyzes your content and CSS files to remove unused selectors.
CSSO (CSS Optimizer) is a CSS minimizer unlike others. In addition to usual minification techniques it can perform structural optimization of CSS files, resulting in smaller file size compared to other minifiers.
This document describes installation and usage of CSSO. If you want to learn more about the inner workings of CSSO, please consult the [manual] (https://github.com/css/csso/blob/master/MANUAL.en.md).
Please report issues on [Github] (https://github.com/css/csso/issues).
For feedback, suggestions, etc. write to skryzhanovsky@ya.ru.
Prerequisites:
To install:
git clone git://github.com/css/csso.git
Prerequisites:
To install (global):
npm install csso -g
To update:
npm update csso
To uninstall:
npm uninstall csso
Open web/csso.html
or http://css.github.com/csso/csso.html in your browser.
CSSO is not guaranteed to work in browsers. Preferred way to use this tool is to run it from the command line or via npm modules.
Sample (test.js
):
var csso = require('csso'),
css = '.test, .test { color: rgb(255, 255, 255) }';
console.log(csso.justDoIt(css));
Output (> node test.js
):
.test{color:#fff}
Use csso.justDoIt(css, true)
to turn structure minimization off.
Run bin/csso
(when installed from git), you will need to have nodejs 0.4.x installed — http://nodejs.org
Run csso
(when installed from npm).
Usage:
csso
shows usage information
csso <filename>
minimizes the CSS in <filename> and outputs the result to stdout
csso <in_filename> <out_filename>
csso -i <in_filename> -o <out_filename>
csso --input <in_filename> --output <out_filename>
minimizes the CSS in <in_filename> and outputs the result to <out_filename>
csso -off
csso --restructure-off
turns structure minimization off
csso -h
csso --help
shows usage information
csso -v
csso --version
shows the version number
Example:
$ echo ".test { color: red; color: green }" > test.css
$ csso test.css
.test{color:green}
Safe transformations:
;
@charset
и @import
declarations0
font-weight
propertyStructural optimizations:
margin
and padding
propertiesThe minification techniques are described in detail in the manual.
1.3.4 (October 10, 2012)
FAQs
CSS minifier with structural optimisations
The npm package csso receives a total of 12,056,742 weekly downloads. As such, csso popularity was classified as popular.
We found that csso demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.