1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-03 04:10:04 +02:00

add some packages

This commit is contained in:
s2
2018-05-05 13:54:07 +02:00
parent 48c1138518
commit ff6e20677d
3738 changed files with 215920 additions and 0 deletions

129
node_modules/clean-css-cli/History.md generated vendored Normal file
View File

@@ -0,0 +1,129 @@
[4.1.11 / 2018-03-02](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.10...v4.1.11)
==================
* Fixed issue [#17](https://github.com/jakubpawlowicz/clean-css-cli/issues/17) - empty `--inline` switch.
[4.1.10 / 2017-09-19](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.9...v4.1.10)
==================
* Bumps clean-css dependency to 4.1.9.
[4.1.9 / 2017-09-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.8...v4.1.9)
==================
* Bumps clean-css dependency to 4.1.8.
[4.1.8 / 2017-09-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.7...v4.1.8)
==================
* Bumps clean-css dependency to 4.1.7.
[4.1.7 / 2017-09-03](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.6...v4.1.7)
==================
* Bumps clean-css dependency to 4.1.6.
[4.1.6 / 2017-06-29](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.5...v4.1.6)
==================
* Bumps clean-css dependency to 4.1.5.
[4.1.5 / 2017-06-14](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.4...v4.1.5)
==================
* Bumps clean-css dependency to 4.1.4.
[4.1.4 / 2017-06-09](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.3...v4.1.4)
==================
* Fixed issue [#10](https://github.com/jakubpawlowicz/clean-css-cli/issues/10) - IE/Edge source maps.
[4.1.3 / 2017-05-18](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.2...v4.1.3)
==================
* Bumps clean-css dependency to 4.1.3.
[4.1.2 / 2017-05-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.1...v4.1.2)
==================
* Bumps clean-css dependency to 4.1.2.
[4.1.0 / 2017-05-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.1.0...v4.1.1)
==================
* Bumps clean-css dependency to 4.1.1.
[4.1.0 / 2017-05-08](https://github.com/jakubpawlowicz/clean-css-cli/compare/4.0...v4.1.0)
==================
* Bumps clean-css dependency to 4.1.x.
* Fixed issue [#1](https://github.com/jakubpawlowicz/clean-css-cli/issues/1) - option to remove inlined files.
* Fixed issue [#2](https://github.com/jakubpawlowicz/clean-css-cli/issues/2) - glob matching source paths.
* Fixed issue [#5](https://github.com/jakubpawlowicz/clean-css-cli/issues/5) - non-boolean compatibility options.
* Fixed issue [#7](https://github.com/jakubpawlowicz/clean-css-cli/issues/7) - using CLI as a module.
[4.0.12 / 2017-04-12](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.11...v4.0.12)
==================
* Bumps clean-css dependency to 4.0.12.
[4.0.11 / 2017-04-11](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.10...v4.0.11)
==================
* Bumps clean-css dependency to 4.0.11.
[4.0.10 / 2017-03-22](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.9...v4.0.10)
==================
* Bumps clean-css dependency to 4.0.10.
[4.0.9 / 2017-03-15](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.8...v4.0.9)
==================
* Bumps clean-css dependency to 4.0.9.
[4.0.8 / 2017-02-22](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.7...v4.0.8)
==================
* Bumps clean-css dependency to 4.0.8.
[4.0.7 / 2017-02-14](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.6...v4.0.7)
==================
* Bumps clean-css dependency to 4.0.7.
[4.0.6 / 2017-02-10](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.5...v4.0.6)
==================
* Bumps clean-css dependency to 4.0.6.
[4.0.5 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.4...v4.0.5)
==================
* Bumps clean-css dependency to 4.0.5.
[4.0.4 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.3...v4.0.4)
==================
* Bumps clean-css dependency to 4.0.4.
[4.0.3 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.2...v4.0.3)
==================
* Bumps clean-css dependency to 4.0.3.
[4.0.2 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.1...v4.0.2)
==================
* Bumps clean-css dependency to 4.0.2.
[4.0.1 / 2017-02-07](https://github.com/jakubpawlowicz/clean-css-cli/compare/v4.0.0...v4.0.1)
==================
* Bumps clean-css dependency to 4.0.1.
4.0.0 / 2017-01-23
==================
* Initial release of separate clean-css-cli.
* See [clean-css release notes](https://github.com/jakubpawlowicz/clean-css/blob/master/History.md#400--2017-01-23) for a full list of changes.

21
node_modules/clean-css-cli/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Jakub Pawlowicz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

394
node_modules/clean-css-cli/README.md generated vendored Normal file
View File

@@ -0,0 +1,394 @@
<h1 align="center">
<br/>
<img src="https://cdn.rawgit.com/jakubpawlowicz/clean-css/master/logo.v2.svg" alt="clean-css logo" width="525px"/>
<br/>
<br/>
</h1>
[![NPM version](https://img.shields.io/npm/v/clean-css-cli.svg?style=flat)](https://www.npmjs.com/package/clean-css-cli)
[![Linux Build Status](https://img.shields.io/travis/jakubpawlowicz/clean-css-cli/master.svg?style=flat&label=Linux%20build)](https://travis-ci.org/jakubpawlowicz/clean-css)
[![Dependency Status](https://img.shields.io/david/jakubpawlowicz/clean-css-cli.svg?style=flat)](https://david-dm.org/jakubpawlowicz/clean-css-cli)
[![NPM Downloads](https://img.shields.io/npm/dm/clean-css-cli.svg)](https://www.npmjs.com/package/clean-css-cli)
[![Twitter](https://img.shields.io/badge/Twitter-@cleancss-blue.svg)](https://twitter.com/cleancss)
clean-css-cli is a command-line interface to [clean-css](https://github.com/jakubpawlowicz/clean-css) - fast and efficient CSS optimizer for [Node.js](http://nodejs.org/).
Previously a part of clean-css it's a separate package since clean-css 4.0.
**Table of Contents**
- [Node.js version support](#nodejs-version-support)
- [Install](#install)
- [Use](#use)
* [Important: 4.0 breaking changes](#important-40-breaking-changes)
* [What's new in version 4.1](#whats-new-in-version-41)
* [CLI options](#cli-options)
* [Compatibility modes](#compatibility-modes)
* [Formatting options](#formatting-options)
* [Inlining options](#inlining-options)
* [Optimization levels](#optimization-levels)
+ [Level 0 optimizations](#level-0-optimizations)
+ [Level 1 optimizations](#level-1-optimizations)
+ [Level 2 optimizations](#level-2-optimizations)
* [As a module](#as-a-module)
- [FAQ](#faq)
* [How to optimize multiple files?](#how-to-optimize-multiple-files)
* [How to specify a custom rounding precision?](#how-to-specify-a-custom-rounding-precision)
* [How to rebase relative image URLs?](#how-to-rebase-relative-image-urls)
* [How to apply level 1 & 2 optimizations at the same time?](#how-to-apply-level-1--2-optimizations-at-the-same-time)
- [Contributing](#contributing)
* [How to get started?](#how-to-get-started)
- [License](#license)
# Node.js version support
clean-css-cli requires Node.js 4.0+ (tested on Linux, OS X, and Windows)
# Install
```shell
npm install clean-css-cli
```
# Use
```shell
cleancss -o one.min.css one.css
```
## Important: 4.0 breaking changes
clean-css-cli 4.0 introduces some breaking changes:
* API and CLI interfaces are split, so CLI has been moved to this repository while API stays at [clean-css](https://github.com/jakubpawlowicz/clean-css);
* `--root` and `--relativeTo` options are replaced by a single option taken from `--output` path - this means that rebasing URLs and import inlining is much simpler but may not be (YMMV) as powerful as in 3.x;
* `--rounding-precision` is disabled by default;
* `--rounding-precision` applies to **all** units now, not only `px` as in 3.x;
* `--skip-import` and `--skip-import-from` are merged into `--inline` option which defaults to `local`. Remote `@import` rules are **NOT** inlined by default anymore;
* renames `--timeout` option to `--inline-timeout`;
* remote resources without a protocol, e.g. `//fonts.googleapis.com/css?family=Domine:700`, are not inlined anymore;
* changes default Internet Explorer compatibility from 9+ to 10+, to revert the old default use `--compatibility ie9` option;
* moves `--rounding-precision`, `--s0`, and `--s1` options to level 1 optimization options, see examples;
* moves `--skip-media-merging`, `--skip-restructuring`, `--semantic-merging`, and `--skip-shorthand-compacting` to level 2 optimizations options, see examples below;
* level 1 optimizations are the new default, up to 3.x it was level 2;
* `--keep-breaks` option is replaced with `--format keep-breaks` to ease transition;
* `--skip-aggressive-merging` option is removed as aggressive merging is replaced by smarter override merging.
## What's new in version 4.1
clean-css-cli 4.1 introduces the following changes / features:
* `--remove-inlined-files` option for removing files inlined in <source-file ...> or via `@import` statements;
* adds glob pattern matching to source paths, see [example](#how-to-optimize-multiple-files);
* allows non-boolean compatibility options, e.g. `--compatibility selectors.mergeLimit=512`;
* extracts CLI into an importable module, so it can be reused and enhanced if needed;
* adds `beforeMinify` callback as a second argument to CLI module, see [example use case](#as-a-module).
## CLI options
```shell
-h, --help output usage information
-v, --version output the version number
-c, --compatibility [ie7|ie8] Force compatibility mode (see Readme for advanced examples)
-d, --debug Shows debug information (minification time & compression efficiency)
-f, --format <options> Controls output formatting, see examples below
-o, --output [output-file] Use [output-file] as output instead of STDOUT
-O <n> [optimizations] Turn on level <n> optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below
--inline [rules] Enables inlining for listed sources (defaults to `local`)
--inline-timeout [seconds] Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)
--remove-inlined-files Remove files inlined in <source-file ...> or via `@import` statements
--skip-rebase Disable URLs rebasing
--source-map Enables building input's source map
--source-map-inline-sources Enables inlining sources inside source maps
```
## Compatibility modes
There is a certain number of compatibility mode shortcuts, namely:
* `--compatibility '*'` (default) - Internet Explorer 10+ compatibility mode
* `--compatibility ie9` - Internet Explorer 9+ compatibility mode
* `--compatibility ie8` - Internet Explorer 8+ compatibility mode
* `--compatibility ie7` - Internet Explorer 7+ compatibility mode
Each of these modes is an alias to a [fine grained configuration](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/options/compatibility.js), with the following options available:
```shell
cleancss --compatibility '*,-properties.urlQuotes'
cleancss --compatibility '*,+properties.ieBangHack,+properties.ieFilters'
# [+-]colors.opacity controls `rgba()` / `hsla()` color support; defaults to `on` (+)
# [+-]properties.backgroundClipMerging controls background-clip merging into shorthand; defaults to `on` (+)
# [+-]properties.backgroundOriginMerging controls background-origin merging into shorthand; defaults to `on` (+)
# [+-]properties.backgroundSizeMerging controls background-size merging into shorthand; defaults to `on` (+)
# [+-]properties.colors controls color optimizations; defaults to `on` (+)
# [+-]properties.ieBangHack controls keeping IE bang hack; defaults to `off` (-)
# [+-]properties.ieFilters controls keeping IE `filter` / `-ms-filter`; defaults to `off` (-)
# [+-]properties.iePrefixHack controls keeping IE prefix hack; defaults to `off` (-)
# [+-]properties.ieSuffixHack controls keeping IE suffix hack; defaults to `off` (-)
# [+-]properties.merging controls property merging based on understandability; defaults to `on` (+)
# [+-]properties.shorterLengthUnits controls shortening pixel units into `pc`, `pt`, or `in` units; defaults to `off` (-)
# [+-]properties.spaceAfterClosingBrace controls keeping space after closing brace - `url() no-repeat` cleancss --compatibility '*,into `url('roperties.no-repeat`; defaults to `on` (+)
# [+-]properties.urlQuotes controls keeping quoting inside `url()`; defaults to `off` (-)
# [+-]properties.zeroUnitsf units `0` value; defaults to `on` (+)
# [+-]selectors.adjacentSpace controls extra space before `nav` element; defaults to `off` (-)
# [+-]selectors.ie7Hack controls removal of IE7 selector hacks, e.g. `*+html...`; defaults to `on` (+)
# [+-]units.ch controls treating `ch` as a supported unit; defaults to `on` (+)
# [+-]units.in controls treating `in` as a supported unit; defaults to `on` (+)
# [+-]units.pc controls treating `pc` as a supported unit; defaults to `on` (+)
# [+-]units.pt controls treating `pt` as a supported unit; defaults to `on` (+)
# [+-]units.rem controls treating `rem` as a supported unit; defaults to `on` (+)
# [+-]units.vh controls treating `vh` as a supported unit; defaults to `on` (+)
# [+-]units.vm controls treating `vm` as a supported unit; defaults to `on` (+)
# [+-]units.vmax controls treating `vmax` as a supported unit; defaults to `on` (+)
# [+-]units.vmin controls treating `vmin` as a supported unit; defaults to `on` (+)
```
You can also chain more rules after a shortcut when setting a compatibility:
```shell
cleancss --compatibility 'ie9,-colors.opacity,-units.rem' one.css
```
## Formatting options
The `--format` option accept the following options:
```shell
cleancss --format beautify one.css
cleancss --format keep-breaks one.css
cleancss --format 'indentBy:1;indentWith:tab' one.css
cleancss --format 'breaks:afterBlockBegins=on;spaces:aroundSelectorRelation=on' one.css
# `breaks` controls where to insert breaks
# `afterAtRule` controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `off` (alias to `false`)
# `afterBlockBegins` controls if a line break comes after a block begins; e.g. `@media`; defaults to `off`
# `afterBlockEnds` controls if a line break comes after a block ends, defaults to `off`
# `afterComment` controls if a line break comes after a comment; defaults to `off`
# `afterProperty` controls if a line break comes after a property; defaults to `off`
# `afterRuleBegins` controls if a line break comes after a rule begins; defaults to `off`
# `afterRuleEnds` controls if a line break comes after a rule ends; defaults to `off`
# `beforeBlockEnds` controls if a line break comes before a block ends; defaults to `off`
# `betweenSelectors` controls if a line break comes between selectors; defaults to `off`
# `indentBy` controls number of characters to indent with; defaults to `0`
# `indentWith` controls a character to indent with, can be `space` or `tab`; defaults to `space`
# `spaces` controls where to insert spaces
# `aroundSelectorRelation` controls if spaces come around selector relations; e.g. `div > a`; defaults to `off`
# `beforeBlockBegins` controls if a space comes before a block begins; e.g. `.block {`; defaults to `off`
# `beforeValue` controls if a space comes before a value; e.g. `width: 1rem`; defaults to `off`
# `wrapAt` controls maximum line length; defaults to `off`
```
## Inlining options
`--inline` option whitelists which `@import` rules will be processed, e.g.
```shell
cleancss --inline local one.css # default
```
```shell
cleancss --inline all # same as local,remote
```
```shell
cleancss --inline local,mydomain.example.com one.css
```
```shell
cleancss --inline 'local,remote,!fonts.googleapis.com' one.css
```
## Optimization levels
The `--level` option can be either `0`, `1` (default), or `2`, e.g.
```shell
cleancss --level 2 one.css
```
or a fine-grained configuration given via a string.
Please note that level 1 optimization options are generally safe while level 2 optimizations should be safe for most users.
### Level 0 optimizations
Level 0 optimizations simply means "no optimizations". Use it when you'd like to inline imports and / or rebase URLs but skip everything else, e.g.
```shell
cleancss -O0 one.css
```
### Level 1 optimizations
Level 1 optimizations (default) operate on single properties only, e.g. can remove units when not required, turn rgb colors to a shorter hex representation, remove comments, etc
Here is a full list of available options:
```shell
cleancss -O1 one.css
cleancss -O1 removeQuotes:off;roundingPrecision:4;specialComments:1 one.css
# `cleanupCharsets` controls `@charset` moving to the front of a stylesheet; defaults to `on`
# `normalizeUrls` controls URL normalzation; default to `on`
# `optimizeBackground` controls `background` property optimizatons; defaults to `on`
# `optimizeBorderRadius` controls `border-radius` property optimizatons; defaults to `on`
# `optimizeFilter` controls `filter` property optimizatons; defaults to `on`
# `optimizeFontWeight` controls `font-weight` property optimizatons; defaults to `on`
# `optimizeOutline` controls `outline` property optimizatons; defaults to `on`
# `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)
# `removeNegativePaddings` controls removing negative paddings; defaults to `on`
# `removeQuotes` controls removing quotes when unnecessary; defaults to `on`
# `removeWhitespace` controls removing unused whitespace; defaults to `on`
# `replaceMultipleZeros` contols removing redundant zeros; defaults to `on`
# `replaceTimeUnits` controls replacing time units with shorter values; defaults to `on
# `replaceZeroUnits` controls replacing zero values with units; defaults to `on`
# `roundingPrecision` rounds pixel values to `N` decimal places; `off` disables rounding; defaults to `off`
# `selectorsSortingMethod` denotes selector sorting method; can be `natural` or `standard`; defaults to `standard`
# `specialComments` denotes a number of /*! ... */ comments preserved; defaults to `all`
# `tidyAtRules` controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `on`
# `tidyBlockScopes` controls block scopes (e.g. `@media`) optimizing; defaults to `on`
# `tidySelectors` controls selectors optimizing; defaults to `on`
```
There is an `all` shortcut for toggling all options at the same time, e.g.
```shell
cleancss -O1 all:off;tidySelectors:on one.css
```
### Level 2 optimizations
Level 2 optimizations operate at rules or multiple properties level, e.g. can remove duplicate rules, remove properties redefined further down a stylesheet, or restructure rules by moving them around.
Please note that if level 2 optimizations are turned on then, unless explicitely disabled, level 1 optimizations are applied as well.
Here is a full list of available options:
```shell
cleancss -O2 one.css
cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;mergeIntoShorthands:off one.css
# `mergeAdjacentRules` controls adjacent rules merging; defaults to `on`
# `mergeIntoShorthands` controls merging properties into shorthands; defaults to `on`
# `mergeMedia` controls `@media` merging; defaults to `on`
# `mergeNonAdjacentRules` controls non-adjacent rule merging; defaults to `on`
# `mergeSemantically` controls semantic merging; defaults to `off`
# `overrideProperties` controls property overriding based on understandability; defaults to `on`
# `reduceNonAdjacentRules` controls non-adjacent rule reducing; defaults to `on`
# `removeDuplicateFontRules` controls duplicate `@font-face` removing; defaults to `on`
# `removeDuplicateMediaBlocks` controls duplicate `@media` removing; defaults to `on`
# `removeDuplicateRules` controls duplicate rules removing; defaults to `on`
# `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)
# `removeUnusedAtRules` controls unused at rule removing; defaults to `off` (since 4.1.0)
# `restructureRules` controls rule restructuring; defaults to `off`
# `skipProperties` controls which properties won\'t be optimized, defaults to empty list which means all will be optimized (since 4.1.0)
```
There is an `all` shortcut for toggling all options at the same time, e.g.
```shell
cleancss -O2 all:off;removeDuplicateRules:on one.css
```
# As a module
clean-css-cli can also be used as a module in a way of enhancing its functionality in a programmatic way, e.g.
```js
#!/usr/bin/env node
var cleanCssCli = require('clean-css-cli');
return cleanCssCli(process, function beforeMinify(cleanCss) {
cleanCss.options.level['1'].transform = function (propertyName, propertyValue) {
if (propertyName == 'background-image' && propertyValue.indexOf('../valid/path/to') == -1) {
return propertyValue.replace('url(', 'url(../valid/path/to/');
}
}
});
```
# FAQ
More answers can be found in [clean-css FAQ section](https://github.com/jakubpawlowicz/clean-css#faq).
## How to optimize multiple files?
It can be done by passing in paths to multiple files, e.g.
```shell
cleancss -o merged.min.css one.css two.css three.css
```
Since version 4.1.0 it can also be done using glob pattern matching, e.g.
```shell
cleancss -o merged.min.css *.css
```
## How to specify a custom rounding precision?
The level 1 `roundingPrecision` optimization option accept a string with per-unit rounding precision settings, e.g.
```shell
cleancss -O1 roundingPrecision:all=3,px=5
```
which sets all units rounding precision to 3 digits except `px` unit precision of 5 digits.
## How to rebase relative image URLs?
clean-css-cli will handle it automatically for you when full paths to input files are passed in and `--output` option is used, e.g
```css
/*! one.css */
a {
background:url(image.png)
}
```
```shell
cleancss -o build/one.min.css one.css
```
```css
/*! build/one.min.css */
a{background:url(../image.png)}
```
## How to apply level 1 & 2 optimizations at the same time?
Using `-O` option twice and specifying optimization options in each, e.g.
```shell
cleancss -O1 all:on,normalizeUrls:off -O2 restructureRules:on one.css
```
will apply level 1 optimizations, except url normalization, and default level 2 optimizations with rule restructuring.
# Contributing
See [CONTRIBUTING.md](https://github.com/jakubpawlowicz/clean-css-cli/blob/master/CONTRIBUTING.md).
## How to get started?
First clone the sources:
```shell
git clone git@github.com:jakubpawlowicz/clean-css-cli.git
```
then install dependencies:
```shell
cd clean-css-cli
npm install
```
then use any of the following commands to verify your copy:
```shell
npm run check # to lint JS sources with [JSHint](https://github.com/jshint/jshint/)
npm test # to run all tests
```
# License
clean-css-cli is released under the [MIT License](https://github.com/jakubpawlowicz/clean-css-cli/blob/master/LICENSE).

4
node_modules/clean-css-cli/bin/cleancss generated vendored Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
var cleanCssCli = require('../index');
return cleanCssCli(process);

305
node_modules/clean-css-cli/index.js generated vendored Normal file
View File

@@ -0,0 +1,305 @@
var fs = require('fs');
var path = require('path');
var CleanCSS = require('clean-css');
var commands = require('commander');
var glob = require('glob');
var COMPATIBILITY_PATTERN = /([\w\.]+)=(\w+)/g;
var lineBreak = require('os').EOL;
function cli(process, beforeMinifyCallback) {
var packageConfig = fs.readFileSync(path.join(__dirname, 'package.json'));
var buildVersion = JSON.parse(packageConfig).version;
var fromStdin;
var debugMode;
var removeInlinedFiles;
var options;
var stdin;
var data;
beforeMinifyCallback = beforeMinifyCallback || Function.prototype;
// Specify commander options to parse command line params correctly
commands
.version(buildVersion, '-v, --version')
.usage('[options] <source-file ...>')
.option('-c, --compatibility [ie7|ie8]', 'Force compatibility mode (see Readme for advanced examples)')
.option('-d, --debug', 'Shows debug information (minification time & compression efficiency)')
.option('-f, --format <options>', 'Controls output formatting, see examples below')
.option('-o, --output [output-file]', 'Use [output-file] as output instead of STDOUT')
.option('-O <n> [optimizations]', 'Turn on level <n> optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below', function (val) { return Math.abs(parseInt(val)); })
.option('--inline [rules]', 'Enables inlining for listed sources (defaults to `local`)')
.option('--inline-timeout [seconds]', 'Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)', parseFloat)
.option('--remove-inlined-files', 'Remove files inlined in <source-file ...> or via `@import` statements')
.option('--skip-rebase', 'Disable URLs rebasing')
.option('--source-map', 'Enables building input\'s source map')
.option('--source-map-inline-sources', 'Enables inlining sources inside source maps');
commands.on('--help', function () {
console.log(' Examples:\n');
console.log(' %> cleancss one.css');
console.log(' %> cleancss -o one-min.css one.css');
console.log(' %> cleancss -o merged-and-minified.css one.css two.css three.css');
console.log(' %> cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz');
console.log('');
console.log(' Formatting options:');
console.log(' %> cleancss --format beautify one.css');
console.log(' %> cleancss --format keep-breaks one.css');
console.log(' %> cleancss --format \'indentBy:1;indentWith:tab\' one.css');
console.log(' %> cleancss --format \'breaks:afterBlockBegins=on;spaces:aroundSelectorRelation=on\' one.css');
console.log(' %> # `breaks` controls where to insert breaks');
console.log(' %> # `afterAtRule` controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `off` (alias to `false`)');
console.log(' %> # `afterBlockBegins` controls if a line break comes after a block begins; e.g. `@media`; defaults to `off`');
console.log(' %> # `afterBlockEnds` controls if a line break comes after a block ends, defaults to `off`');
console.log(' %> # `afterComment` controls if a line break comes after a comment; defaults to `off`');
console.log(' %> # `afterProperty` controls if a line break comes after a property; defaults to `off`');
console.log(' %> # `afterRuleBegins` controls if a line break comes after a rule begins; defaults to `off`');
console.log(' %> # `afterRuleEnds` controls if a line break comes after a rule ends; defaults to `off`');
console.log(' %> # `beforeBlockEnds` controls if a line break comes before a block ends; defaults to `off`');
console.log(' %> # `betweenSelectors` controls if a line break comes between selectors; defaults to `off`');
console.log(' %> # `indentBy` controls number of characters to indent with; defaults to `0`');
console.log(' %> # `indentWith` controls a character to indent with, can be `space` or `tab`; defaults to `space`');
console.log(' %> # `spaces` controls where to insert spaces');
console.log(' %> # `aroundSelectorRelation` controls if spaces come around selector relations; e.g. `div > a`; defaults to `off`');
console.log(' %> # `beforeBlockBegins` controls if a space comes before a block begins; e.g. `.block {`; defaults to `off`');
console.log(' %> # `beforeValue` controls if a space comes before a value; e.g. `width: 1rem`; defaults to `off`');
console.log(' %> # `wrapAt` controls maximum line length; defaults to `off`');
console.log('');
console.log(' Level 0 optimizations:');
console.log(' %> cleancss -O0 one.css');
console.log('');
console.log(' Level 1 optimizations:');
console.log(' %> cleancss -O1 one.css');
console.log(' %> cleancss -O1 removeQuotes:off;roundingPrecision:4;specialComments:1 one.css');
console.log(' %> cleancss -O1 all:off;specialComments:1 one.css');
console.log(' %> # `cleanupCharsets` controls `@charset` moving to the front of a stylesheet; defaults to `on`');
console.log(' %> # `normalizeUrls` controls URL normalzation; default to `on`');
console.log(' %> # `optimizeBackground` controls `background` property optimizatons; defaults to `on`');
console.log(' %> # `optimizeBorderRadius` controls `border-radius` property optimizatons; defaults to `on`');
console.log(' %> # `optimizeFilter` controls `filter` property optimizatons; defaults to `on`');
console.log(' %> # `optimizeFontWeight` controls `font-weight` property optimizatons; defaults to `on`');
console.log(' %> # `optimizeOutline` controls `outline` property optimizatons; defaults to `on`');
console.log(' %> # `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)');
console.log(' %> # `removeNegativePaddings` controls removing negative paddings; defaults to `on`');
console.log(' %> # `removeQuotes` controls removing quotes when unnecessary; defaults to `on`');
console.log(' %> # `removeWhitespace` controls removing unused whitespace; defaults to `on`');
console.log(' %> # `replaceMultipleZeros` contols removing redundant zeros; defaults to `on`');
console.log(' %> # `replaceTimeUnits` controls replacing time units with shorter values; defaults to `on');
console.log(' %> # `replaceZeroUnits` controls replacing zero values with units; defaults to `on`');
console.log(' %> # `roundingPrecision` rounds pixel values to `N` decimal places; `off` disables rounding; defaults to `off`');
console.log(' %> # `selectorsSortingMethod` denotes selector sorting method; can be `natural` or `standard`; defaults to `standard`');
console.log(' %> # `specialComments` denotes a number of /*! ... */ comments preserved; defaults to `all`');
console.log(' %> # `tidyAtRules` controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `on`');
console.log(' %> # `tidyBlockScopes` controls block scopes (e.g. `@media`) optimizing; defaults to `on`');
console.log(' %> # `tidySelectors` controls selectors optimizing; defaults to `on`');
console.log('');
console.log(' Level 2 optimizations:');
console.log(' %> cleancss -O2 one.css');
console.log(' %> cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;mergeIntoShorthands:off one.css');
console.log(' %> cleancss -O2 all:off;removeDuplicateRules:on one.css');
console.log(' %> # `mergeAdjacentRules` controls adjacent rules merging; defaults to `on`');
console.log(' %> # `mergeIntoShorthands` controls merging properties into shorthands; defaults to `on`');
console.log(' %> # `mergeMedia` controls `@media` merging; defaults to `on`');
console.log(' %> # `mergeNonAdjacentRules` controls non-adjacent rule merging; defaults to `on`');
console.log(' %> # `mergeSemantically` controls semantic merging; defaults to `off`');
console.log(' %> # `overrideProperties` controls property overriding based on understandability; defaults to `on`');
console.log(' %> # `reduceNonAdjacentRules` controls non-adjacent rule reducing; defaults to `on`');
console.log(' %> # `removeDuplicateFontRules` controls duplicate `@font-face` removing; defaults to `on`');
console.log(' %> # `removeDuplicateMediaBlocks` controls duplicate `@media` removing; defaults to `on`');
console.log(' %> # `removeDuplicateRules` controls duplicate rules removing; defaults to `on`');
console.log(' %> # `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)');
console.log(' %> # `removeUnusedAtRules` controls unused at rule removing; defaults to `off` (since 4.1.0)');
console.log(' %> # `restructureRules` controls rule restructuring; defaults to `off`');
console.log(' %> # `skipProperties` controls which properties won\'t be optimized, defaults to empty list which means all will be optimized (since 4.1.0)');
process.exit();
});
commands.parse(process.argv);
if (commands.rawArgs.indexOf('-O0') > -1) {
commands.O0 = true;
}
if (commands.rawArgs.indexOf('-O1') > -1) {
commands.O1 = findArgumentTo('-O1', commands.rawArgs, commands.args);
}
if (commands.rawArgs.indexOf('-O2') > -1) {
commands.O2 = findArgumentTo('-O2', commands.rawArgs, commands.args);
}
// If no sensible data passed in just print help and exit
fromStdin = !process.env.__DIRECT__ && !process.stdin.isTTY;
if (!fromStdin && commands.args.length === 0) {
commands.outputHelp();
return 0;
}
// Now coerce commands into CleanCSS configuration...
debugMode = commands.debug;
removeInlinedFiles = commands.removeInlinedFiles;
options = {
compatibility: commands.compatibility,
format: commands.format,
inline: typeof commands.inline == 'string' ? commands.inline : 'local',
inlineTimeout: commands.inlineTimeout * 1000,
level: commands.O0 || commands.O1 || commands.O2 ?
{ '0': commands.O0, '1': commands.O1, '2': commands.O2 } :
undefined,
output: commands.output,
rebase: commands.skipRebase ? false : true,
rebaseTo: ('output' in commands) && commands.output.length > 0 ? path.dirname(path.resolve(commands.output)) : process.cwd(),
sourceMap: commands.sourceMap,
sourceMapInlineSources: commands.sourceMapInlineSources
};
if (options.sourceMap && !options.output) {
outputFeedback(['Source maps will not be built because you have not specified an output file.'], true);
options.sourceMap = false;
}
// ... and do the magic!
if (commands.args.length > 0) {
minify(process, beforeMinifyCallback, options, debugMode, removeInlinedFiles, expandGlobs(commands.args));
} else {
stdin = process.openStdin();
stdin.setEncoding('utf-8');
data = '';
stdin.on('data', function (chunk) {
data += chunk;
});
stdin.on('end', function () {
minify(process, beforeMinifyCallback, options, debugMode, removeInlinedFiles, data);
});
}
}
function findArgumentTo(option, rawArgs, args) {
var value = true;
var optionAt = rawArgs.indexOf(option);
var nextOption = rawArgs[optionAt + 1];
var looksLikePath;
var asArgumentAt;
if (!nextOption) {
return value;
}
looksLikePath = nextOption.indexOf('.css') > -1 ||
/\//.test(nextOption) ||
/\\[^\-]/.test(nextOption) ||
/^https?:\/\//.test(nextOption);
asArgumentAt = args.indexOf(nextOption);
if (!looksLikePath) {
value = nextOption;
}
if (!looksLikePath && asArgumentAt > -1) {
args.splice(asArgumentAt, 1);
}
return value;
}
function expandGlobs(paths) {
return paths.reduce(function (accumulator, path) {
return accumulator.concat(glob.sync(path, { nodir: true, nonull: true}));
}, []);
}
function minify(process, beforeMinifyCallback, options, debugMode, removeInlinedFiles, data) {
var cleanCss = new CleanCSS(options);
applyNonBooleanCompatibilityFlags(cleanCss, options.compatibility);
beforeMinifyCallback(cleanCss);
cleanCss.minify(data, function (errors, minified) {
var mapFilename;
if (debugMode) {
console.error('Original: %d bytes', minified.stats.originalSize);
console.error('Minified: %d bytes', minified.stats.minifiedSize);
console.error('Efficiency: %d%', ~~(minified.stats.efficiency * 10000) / 100.0);
console.error('Time spent: %dms', minified.stats.timeSpent);
if (minified.inlinedStylesheets.length > 0) {
console.error('Inlined stylesheets:');
minified.inlinedStylesheets.forEach(function (uri) {
console.error('- %s', uri);
});
}
}
outputFeedback(minified.errors, true);
outputFeedback(minified.warnings);
if (minified.errors.length > 0) {
process.exit(1);
}
if (removeInlinedFiles) {
minified.inlinedStylesheets.forEach(fs.unlinkSync);
}
if (minified.sourceMap) {
mapFilename = path.basename(options.output) + '.map';
output(process, options, minified.styles + lineBreak + '/*# sourceMappingURL=' + mapFilename + ' */');
outputMap(options, minified.sourceMap, mapFilename);
} else {
output(process, options, minified.styles);
}
});
}
function applyNonBooleanCompatibilityFlags(cleanCss, compatibility) {
var match;
var scope;
var parts;
var i, l;
if (!compatibility) {
return;
}
patternLoop:
while ((match = COMPATIBILITY_PATTERN.exec(compatibility)) !== null) {
scope = cleanCss.options.compatibility;
parts = match[1].split('.');
for (i = 0, l = parts.length - 1; i < l; i++) {
scope = scope[parts[i]];
if (!scope) {
continue patternLoop;
}
}
scope[parts.pop()] = match[2];
}
}
function outputFeedback(messages, isError) {
var prefix = isError ? '\x1B[31mERROR\x1B[39m:' : 'WARNING:';
messages.forEach(function (message) {
console.error('%s %s', prefix, message);
});
}
function output(process, options, minified) {
if (options.output) {
fs.writeFileSync(options.output, minified, 'utf8');
} else {
process.stdout.write(minified);
}
}
function outputMap(options, sourceMap, mapFilename) {
var mapPath = path.join(path.dirname(options.output), mapFilename);
fs.writeFileSync(mapPath, sourceMap.toString(), 'utf-8');
}
module.exports = cli;

79
node_modules/clean-css-cli/package.json generated vendored Normal file
View File

@@ -0,0 +1,79 @@
{
"_from": "clean-css-cli",
"_id": "clean-css-cli@4.1.11",
"_inBundle": false,
"_integrity": "sha1-AcVonwW8USojKF8d79veALwR2Gw=",
"_location": "/clean-css-cli",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "clean-css-cli",
"name": "clean-css-cli",
"escapedName": "clean-css-cli",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/clean-css-cli/-/clean-css-cli-4.1.11.tgz",
"_shasum": "01c5689f05bc512a23285f1defdbde00bc11d86c",
"_spec": "clean-css-cli",
"_where": "/home/s2/Documents/Code/minifyfromhtml",
"author": {
"name": "Jakub Pawlowicz",
"email": "contact@jakubpawlowicz.com",
"url": "http://twitter.com/jakubpawlowicz"
},
"bin": {
"cleancss": "./bin/cleancss"
},
"bugs": {
"url": "https://github.com/jakubpawlowicz/clean-css-cli/issues"
},
"bundleDependencies": false,
"dependencies": {
"clean-css": "^4.1.9",
"commander": "2.x",
"glob": "7.x"
},
"deprecated": false,
"description": "A command-line interface to clean-css CSS optimization library",
"devDependencies": {
"http-proxy": "1.x",
"jshint": "2.x",
"source-map": "0.5.x",
"vows": "0.8.x"
},
"engines": {
"node": ">= 4.0"
},
"files": [
"bin",
"History.md",
"index.js",
"LICENSE"
],
"homepage": "https://github.com/jakubpawlowicz/clean-css-cli#readme",
"keywords": [
"css",
"optimizer",
"minifier"
],
"license": "MIT",
"main": "index.js",
"name": "clean-css-cli",
"repository": {
"type": "git",
"url": "git+https://github.com/jakubpawlowicz/clean-css-cli.git"
},
"scripts": {
"check": "jshint ./bin/cleancss .",
"prepublish": "npm run check",
"test": "vows"
},
"version": "4.1.11"
}