clean-css-cli
Advanced tools
Comparing version 4.0.0-rc0 to 4.0.0
{ | ||
"name": "clean-css-cli", | ||
"version": "4.0.0-rc0", | ||
"version": "4.0.0", | ||
"description": "A command-line interface to clean-css CSS optimization library", | ||
@@ -29,3 +29,3 @@ "scripts": { | ||
"dependencies": { | ||
"clean-css": "jakubpawlowicz/clean-css#fdf123b", | ||
"clean-css": "4.x", | ||
"commander": "2.x" | ||
@@ -32,0 +32,0 @@ }, |
356
README.md
@@ -1,2 +0,354 @@ | ||
# clean-css-cli | ||
The command line interface to clean-css CSS optimizer | ||
<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) | ||
* [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) | ||
- [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. | ||
## 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) | ||
--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` | ||
# `optimizeFont controls `font` property optimizatons; defaults to `on` | ||
# `optimizeFontWeight` controls `font-weight` property optimizatons; defaults to `on` | ||
# `optimizeOutline` controls `outline` property optimizatons; defaults to `on` | ||
# `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` | ||
# `restructureRules` controls rule restructuring; defaults to `off` | ||
``` | ||
There is an `all` shortcut for toggling all options at the same time, e.g. | ||
```shell | ||
cleancss -O2 all:off;removeDuplicateRules:on one.css | ||
``` | ||
# 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 | ||
``` | ||
## 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). |
@@ -1,2 +0,1 @@ | ||
var vows = require('vows'); | ||
var assert = require('assert'); | ||
@@ -6,14 +5,10 @@ var exec = require('child_process').exec; | ||
var http = require('http'); | ||
var httpProxy = require('http-proxy'); | ||
var path = require('path'); | ||
var url = require('url'); | ||
var httpProxy = require('http-proxy'); | ||
var SourceMapConsumer = require('source-map').SourceMapConsumer; | ||
var vows = require('vows'); | ||
var isWindows = process.platform == 'win32'; | ||
var lineBreakRegExp = new RegExp(require('os').EOL, 'g'); | ||
var binaryContext = function (options, context) { | ||
if (isWindows) | ||
return {}; | ||
function binaryContext(options, context) { | ||
context.topic = function () { | ||
@@ -23,31 +18,19 @@ // We add __DIRECT__=1 to force binary into 'non-piped' mode | ||
}; | ||
return context; | ||
}; | ||
} | ||
var pipedContext = function (css, options, context) { | ||
if (isWindows) | ||
return {}; | ||
function pipedContext(css, options, context) { | ||
context.topic = function () { | ||
exec('echo "' + css + '" | ./bin/cleancss ' + options, this.callback); | ||
}; | ||
return context; | ||
}; | ||
} | ||
var unixOnlyContext = function (context) { | ||
return isWindows ? {} : context; | ||
}; | ||
function deleteFile(filename) { | ||
exec('rm ' + filename); | ||
} | ||
var readFile = function (filename) { | ||
return fs.readFileSync(filename, { encoding: 'utf-8' }).replace(lineBreakRegExp, ''); | ||
}; | ||
var deleteFile = function (filename) { | ||
if (isWindows) | ||
exec('del /q /f ' + filename); | ||
else | ||
exec('rm ' + filename); | ||
}; | ||
vows.describe('./bin/cleancss') | ||
vows.describe('cleancss') | ||
.addBatch({ | ||
@@ -79,3 +62,3 @@ 'no options': binaryContext('', { | ||
'should output help': function (error, stdout) { | ||
var version = JSON.parse(fs.readFileSync('./package.json')).version; | ||
var version = JSON.parse(fs.readFileSync('./package.json', 'utf-8')).version; | ||
assert.equal(stdout, version + '\n'); | ||
@@ -152,3 +135,3 @@ } | ||
'should output content to file': function () { | ||
var minimized = readFile('debug.css'); | ||
var minimized = fs.readFileSync('debug.css', 'utf-8'); | ||
assert.equal(minimized, 'a{color:red}'); | ||
@@ -192,5 +175,5 @@ }, | ||
.addBatch({ | ||
'from source': binaryContext('-O2 ./test/fixtures/reset.css', { | ||
'from source': binaryContext('--format keep-breaks -O2 ./test/fixtures/reset.css', { | ||
'should minimize': function (error, stdout) { | ||
var minimized = fs.readFileSync('./test/fixtures/reset-min.css', 'utf-8').replace(lineBreakRegExp, ''); | ||
var minimized = fs.readFileSync('./test/fixtures/reset-min.css', 'utf-8'); | ||
assert.equal(stdout, minimized); | ||
@@ -208,3 +191,3 @@ } | ||
.addBatch({ | ||
'to file': binaryContext('-O2 -o ./reset1-min.css ./test/fixtures/reset.css', { | ||
'to file': binaryContext('--format keep-breaks -O2 -o ./reset1-min.css ./test/fixtures/reset.css', { | ||
'should give no output': function (error, stdout) { | ||
@@ -214,4 +197,4 @@ assert.isEmpty(stdout); | ||
'should minimize': function () { | ||
var preminified = readFile('./test/fixtures/reset-min.css'); | ||
var minified = readFile('./reset1-min.css'); | ||
var preminified = fs.readFileSync('./test/fixtures/reset-min.css', 'utf-8'); | ||
var minified = fs.readFileSync('./reset1-min.css', 'utf-8'); | ||
assert.equal(minified, preminified); | ||
@@ -262,3 +245,3 @@ }, | ||
'should rewrite path relative to current path': function () { | ||
var minimized = readFile('./base1-min.css'); | ||
var minimized = fs.readFileSync('./base1-min.css', 'utf-8'); | ||
assert.equal(minimized, 'a{background:url(test/fixtures/partials/extra/down.gif) 0 0 no-repeat}'); | ||
@@ -272,3 +255,3 @@ }, | ||
'should keep paths as they are': function () { | ||
var minimized = readFile('base3-min.css'); | ||
var minimized = fs.readFileSync('base3-min.css', 'utf-8'); | ||
assert.equal(minimized, 'a{background:url(test/fixtures/partials/extra/down.gif)}'); | ||
@@ -301,3 +284,3 @@ }, | ||
'should rebase urls correctly': function () { | ||
var minimized = readFile('test/ui.bundled.css'); | ||
var minimized = fs.readFileSync('test/ui.bundled.css', 'utf-8'); | ||
assert.include(minimized, 'url(fixtures/rebasing/components/bootstrap/images/glyphs.gif)'); | ||
@@ -347,3 +330,3 @@ assert.include(minimized, 'url(fixtures/rebasing/components/jquery-ui/images/prev.gif)'); | ||
.addBatch({ | ||
'timeout': unixOnlyContext({ | ||
'timeout': { | ||
topic: function () { | ||
@@ -369,6 +352,6 @@ var self = this; | ||
} | ||
}) | ||
} | ||
}) | ||
.addBatch({ | ||
'HTTP proxy': unixOnlyContext({ | ||
'HTTP proxy': { | ||
topic: function () { | ||
@@ -403,8 +386,8 @@ var self = this; | ||
} | ||
}) | ||
} | ||
}) | ||
.addBatch({ | ||
'ie7 compatibility': binaryContext('--compatibility ie7 ./test/fixtures/unsupported/selectors-ie7.css', { | ||
'ie7 compatibility': binaryContext('--format keep-breaks --compatibility ie7 ./test/fixtures/unsupported/selectors-ie7.css', { | ||
'should not transform source': function (error, stdout) { | ||
assert.equal(stdout, readFile('./test/fixtures/unsupported/selectors-ie7.css')); | ||
assert.equal(stdout, fs.readFileSync('./test/fixtures/unsupported/selectors-ie7.css', 'utf-8').trim()); | ||
} | ||
@@ -414,5 +397,5 @@ }) | ||
.addBatch({ | ||
'ie8 compatibility': binaryContext('--compatibility ie8 ./test/fixtures/unsupported/selectors-ie8.css', { | ||
'ie8 compatibility': binaryContext('--format keep-breaks --compatibility ie8 ./test/fixtures/unsupported/selectors-ie8.css', { | ||
'should not transform source': function (error, stdout) { | ||
assert.equal(stdout, readFile('./test/fixtures/unsupported/selectors-ie8.css')); | ||
assert.equal(stdout, fs.readFileSync('./test/fixtures/unsupported/selectors-ie8.css', 'utf-8').trim()); | ||
} | ||
@@ -505,3 +488,3 @@ }) | ||
'includes map in minified file': function () { | ||
assert.include(readFile('./reset.min.css'), '/*# sourceMappingURL=reset.min.css.map */'); | ||
assert.include(fs.readFileSync('./reset.min.css', 'utf-8'), '/*# sourceMappingURL=reset.min.css.map */'); | ||
}, | ||
@@ -512,3 +495,3 @@ 'creates a map file': function () { | ||
'includes right content in map file': function () { | ||
var sourceMap = new SourceMapConsumer(readFile('./reset.min.css.map')); | ||
var sourceMap = new SourceMapConsumer(fs.readFileSync('./reset.min.css.map', 'utf-8')); | ||
assert.deepEqual( | ||
@@ -531,3 +514,3 @@ sourceMap.originalPositionFor({ line: 1, column: 1 }), | ||
.addBatch({ | ||
'source maps - output file in same folder as input': unixOnlyContext({ | ||
'source maps - output file in same folder as input': { | ||
topic: function () { | ||
@@ -541,3 +524,3 @@ var self = this; | ||
'includes right content in map file': function () { | ||
var sourceMap = new SourceMapConsumer(readFile('./reset.min.css.map')); | ||
var sourceMap = new SourceMapConsumer(fs.readFileSync('./reset.min.css.map', 'utf-8')); | ||
assert.deepEqual( | ||
@@ -558,3 +541,3 @@ sourceMap.originalPositionFor({ line: 1, column: 1 }), | ||
} | ||
}) | ||
} | ||
}) | ||
@@ -564,3 +547,3 @@ .addBatch({ | ||
'includes right content in map file': function () { | ||
var sourceMap = new SourceMapConsumer(readFile('./styles.min.css.map')); | ||
var sourceMap = new SourceMapConsumer(fs.readFileSync('./styles.min.css.map', 'utf-8')); | ||
assert.deepEqual( | ||
@@ -585,3 +568,3 @@ sourceMap.originalPositionFor({ line: 1, column: 1 }), | ||
'includes right content in map file': function () { | ||
var sourceMap = new SourceMapConsumer(readFile('./styles-relative.min.css.map')); | ||
var sourceMap = new SourceMapConsumer(fs.readFileSync('./styles-relative.min.css.map', 'utf-8')); | ||
assert.deepEqual( | ||
@@ -606,6 +589,6 @@ sourceMap.originalPositionFor({ line: 1, column: 1 }), | ||
'includes map in minified file': function () { | ||
assert.include(readFile('./import.min.css'), '/*# sourceMappingURL=import.min.css.map */'); | ||
assert.include(fs.readFileSync('./import.min.css', 'utf-8'), '/*# sourceMappingURL=import.min.css.map */'); | ||
}, | ||
'includes right content in map file': function () { | ||
var sourceMap = new SourceMapConsumer(readFile('./import.min.css.map')); | ||
var sourceMap = new SourceMapConsumer(fs.readFileSync('./import.min.css.map', 'utf-8')); | ||
var count = 0; | ||
@@ -625,6 +608,6 @@ sourceMap.eachMapping(function () { count++; }); | ||
'includes map in minified file': function () { | ||
assert.include(readFile('./import-inline.min.css'), '/*# sourceMappingURL=import-inline.min.css.map */'); | ||
assert.include(fs.readFileSync('./import-inline.min.css', 'utf-8'), '/*# sourceMappingURL=import-inline.min.css.map */'); | ||
}, | ||
'includes embedded sources': function () { | ||
var sourceMap = new SourceMapConsumer(readFile('./import-inline.min.css.map')); | ||
var sourceMap = new SourceMapConsumer(fs.readFileSync('./import-inline.min.css.map', 'utf-8')); | ||
var count = 0; | ||
@@ -631,0 +614,0 @@ sourceMap.eachMapping(function () { count++; }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
61314
40
0
355
0
3
757
+ Addedclean-css@4.2.4(transitive)
+ Addedsource-map@0.6.1(transitive)
Updatedclean-css@4.x