Socket
Socket
Sign inDemoInstall

csso

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csso - npm Package Compare versions

Comparing version 1.3.11 to 1.3.12

test/data/test_stylesheet/issue134.test1.cl

32

CHANGELOG.md

@@ -1,14 +0,19 @@

CSSO changelog
===================
## 1.3.11 (October 8, 2015)
11.02.2013, Version 1.3.7
- Case insensitive check for `!important` (issue #187)
- Fix problems with using `csso` as cli command on Windows (issue #83, #136, #142 and others)
- Remove byte order marker (the UTF-8 BOM) from input
- Do not strip space between funktion-funktion and funktion-vhash (issue #134)
- Do not merge TRBL values having \9 (hack for IE8 in bootstrap) (issues #159, #214, #230, #231 and others)
- Don't strip units off dimensions of non-length (issues #226, #229 and others)
## 1.3.7 (February 11, 2013)
- Gonzales 1.0.7.
26.11.2012, Version 1.3.6
## 1.3.6 (November 26, 2012)
- Gonzales 1.0.6.
28.10.2012, Version 1.3.5
-------------------------
## 1.3.5 (October 28, 2012)

@@ -22,25 +27,20 @@ - Gonzales 1.0.5.

10.10.2012, Version 1.3.4
-------------------------
## 1.3.4 (October 10, 2012)
- @page inside @media Causes Error: https://github.com/css/csso/issues/90
09.10.2012, Version 1.3.3
-------------------------
## 1.3.3 (October 9, 2012)
- CSSO 1.3.2 compresses ".t-1" and ".t-01" as identical classes: https://github.com/css/csso/issues/88
08.10.2012, Version 1.3.2
-------------------------
## 1.3.2 (October 8, 2012)
- filter + important breaks CSSO v1.3.1: https://github.com/css/csso/issues/87
08.10.2012, Version 1.3.1
-------------------------
## 1.3.1 (October 8, 2012)
- "filter" IE property breaks CSSO v1.3.0: https://github.com/css/csso/issues/86
04.10.2012, Version 1.3.0
-------------------------
## 1.3.0 (October 4, 2012)
- PeCode CSS parser replaced by Gonzales CSS parser
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.
# 1. Minification
## Minification

@@ -10,5 +10,5 @@ Minification is a process of transforming a CSS document into a smaller document without losses. The typical strategies of achieving this are:

## 1.1. Basic transformations
### Basic transformations
### 1.1.1. Removal of whitespace
#### Removal of whitespace

@@ -34,3 +34,3 @@ In some cases, whitespace characters (` `, `\n`, `\r`, `\t`, `\f`) are unnecessary and do not affect rendering.

### 1.1.2. Removal of trailing ';'
#### Removal of trailing ';'

@@ -53,3 +53,3 @@ The last semicolon in a block is not required and does not affect rendering.

### 1.1.3. Removal of comments
#### Removal of comments

@@ -94,3 +94,3 @@ Comments do not affect rendering: \[[CSS 2.1 / 4.1.9 Comments](http://www.w3.org/TR/CSS21/syndata.html#comments)\].

### 1.1.4. Removal of invalid @charset and @import declarations
#### Removal of invalid @charset and @import declarations

@@ -128,3 +128,3 @@ According to the specification, `@charset` must be placed at the very beginning of the stylesheet: \[[CSS 2.1 / 4.4 CSS style sheet representation](http://www.w3.org/TR/CSS21/syndata.html#charset)\].

### 1.1.5. Minification of color properties
#### Minification of color properties

@@ -155,3 +155,3 @@ Some color values are minimized according to \[[CSS 2.1 / 4.3.6 Colors](http://www.w3.org/TR/CSS21/syndata.html#color-units)\].

### 1.1.6. Minification of 0
#### Minification of 0

@@ -176,3 +176,3 @@ In some cases, the numeric values can be compacted to `0` or even dropped.

### 1.1.7. Minification of multi-line strings
#### Minification of multi-line strings

@@ -197,3 +197,3 @@ Multi-line strings are minified according to \[[CSS 2.1 / 4.3.7 Strings](http://www.w3.org/TR/CSS21/syndata.html#strings)\].

### 1.1.8. Minification of the font-weight property
#### Minification of the font-weight property

@@ -224,5 +224,5 @@ The `bold` and `normal` values of the `font-weight` property are minimized according to \[[CSS 2.1 / 15.6 Font boldness: the 'font-weight' property](http://www.w3.org/TR/CSS21/fonts.html#font-boldness)\].

## 1.2. Structural optimizations
### Structural optimizations
### 1.2.1. Merging blocks with identical selectors
#### Merging blocks with identical selectors

@@ -266,3 +266,3 @@ Adjacent blocks with identical selectors are merged.

### 1.2.2. Merging blocks with identical properties
#### Merging blocks with identical properties

@@ -305,3 +305,3 @@ Adjacent blocks with identical properties are merged.

### 1.2.3. Removal of overridden properties
#### Removal of overridden properties

@@ -332,3 +332,3 @@ Properties ignored by the browser can be removed using the following rules:

#### 1.2.3.1. Removal of overridden shorthand properties
##### Removal of overridden shorthand properties

@@ -352,3 +352,3 @@ In case of `border`, `margin`, `padding`, `font` and `list-style` properties, the following removal rule will be applied: if the last property is a 'general' one (for example, `border`), then all preceding overridden properties will be removed (for example, `border-top-width` or `border-style`).

### 1.2.4. Removal of repeating selectors
#### Removal of repeating selectors

@@ -371,3 +371,3 @@ Repeating selectors can be removed.

### 1.2.5. Partial merging of blocks
#### Partial merging of blocks

@@ -442,3 +442,3 @@ Given two adjacent blocks where one of the blocks is a subset of the other one, the following optimization is possible:

### 1.2.6. Partial splitting of blocks
#### Partial splitting of blocks

@@ -515,3 +515,3 @@ If two adjacent blocks contain intersecting properties the following minification is possible:

### 1.2.7. Removal of empty ruleset and at-rule
#### Removal of empty ruleset and at-rule

@@ -544,5 +544,5 @@ Empty ruleset and at-rule will be removed.

### 1.2.8. Minification of margin and padding properties
#### Minification of margin and padding properties
The `margin` and `padding` properties are minimized according to \[[CSS 2.1 / 8.3 Margin properties](http://www.w3.org/TR/CSS21/box.html#margin-properties)\] и \[[CSS 2.1 / 8.4 Padding properties](http://www.w3.org/TR/CSS21/box.html#padding-properties)\].
The `margin` and `padding` properties are minimized according to \[[CSS 2.1 / 8.3 Margin properties](http://www.w3.org/TR/CSS21/box.html#margin-properties)\] and \[[CSS 2.1 / 8.4 Padding properties](http://www.w3.org/TR/CSS21/box.html#padding-properties)\].

@@ -598,3 +598,3 @@ * Before:

# 2. Recommendations
## Recommendations

@@ -605,11 +605,11 @@ Some stylesheets compress better than the others. Sometimes, one character difference can turn a well-compressible stylesheet to a very inconvenient one.

## 2.1. Length of selectors
### Length of selectors
Shorter selectors are easier to re-group.
## 2.2. Order of properties
### Order of properties
Stick to the same order of properties throughout the stylesheet - it will allow you to not use the guards. The less manual intervention there is, the easier it is for the minimizer to work optimally.
## 2.3. Positioning of similar blocks
### Positioning of similar blocks

@@ -662,3 +662,3 @@ Keep blocks with similar sets of properties close to each other.

## 2.4. Using !important
### Using !important

@@ -665,0 +665,0 @@ It should go without saying that using the `!important` declaration harms minification performance.

CSSO (CSS Optimizer) является минимизатором CSS, выполняющим как минимизацию без изменения структуры, так и структурную минимизацию с целью получить как можно меньший текст.
# 1. Минимизация
## Минимизация

@@ -10,5 +10,5 @@ Цель минимизации заключается в трансформации исходного CSS в CSS меньшего размера. Наиболее распространёнными стратегиями в достижении этой цели являются:

## 1.1. Минимизация без изменения структуры
### Минимизация без изменения структуры
### 1.1.1. Удаление whitespace
#### Удаление whitespace

@@ -34,3 +34,3 @@ В ряде случаев символы ряда whitespace (` `, `\n`, `\r`, `\t`, `\f`) являются необязательными и не влияют на результат применения таблицы стилей.

### 1.1.2. Удаление концевых ';'
#### Удаление концевых ';'

@@ -53,3 +53,3 @@ Символ `;`, завершающий перечисление свойств в блоке, является необязательным и не влияет на результат применения таблицы стилей.

### 1.1.3. Удаление комментариев
#### Удаление комментариев

@@ -94,3 +94,3 @@ Комментарии не влияют на результат применения таблицы стилей: \[[CSS 2.1 / 4.1.9 Comments](http://www.w3.org/TR/CSS21/syndata.html#comments)\].

### 1.1.4. Удаление неправильных @charset и @import
#### Удаление неправильных @charset и @import

@@ -128,3 +128,3 @@ Единственно верным расположением `@charset` является начало текста: \[[CSS 2.1 / 4.4 CSS style sheet representation](http://www.w3.org/TR/CSS21/syndata.html#charset)\].

### 1.1.5. Минимизация цвета
#### Минимизация цвета

@@ -155,3 +155,3 @@ Некоторые значения цвета минимизируются согласно \[[CSS 2.1 / 4.3.6 Colors](http://www.w3.org/TR/CSS21/syndata.html#color-units)\].

### 1.1.6. Минимизация 0
#### Минимизация 0

@@ -176,3 +176,3 @@ В ряде случаев числовое значение можно сократить до `0` или же отбросить `0`.

### 1.1.7. Слияние многострочных строк в однострочные
#### Слияние многострочных строк в однострочные

@@ -197,3 +197,3 @@ Многострочные строки минимизируются согласно \[[CSS 2.1 / 4.3.7 Strings](http://www.w3.org/TR/CSS21/syndata.html#strings)\].

### 1.1.8. Минимизация font-weight
#### Минимизация font-weight

@@ -224,5 +224,5 @@ Значения `bold` и `normal` свойства `font-weight` минимизируются согласно \[[CSS 2.1 / 15.6 Font boldness: the 'font-weight' property](http://www.w3.org/TR/CSS21/fonts.html#font-boldness)\].

## 1.2. Минимизация с изменением структуры
### Минимизация с изменением структуры
### 1.2.1. Слияние блоков с одинаковыми селекторами
#### Слияние блоков с одинаковыми селекторами

@@ -266,3 +266,3 @@ В один блок сливаются соседние блоки с одинаковым набором селекторов.

### 1.2.2. Слияние блоков с одинаковыми свойствами
#### Слияние блоков с одинаковыми свойствами

@@ -305,3 +305,3 @@ В один блок сливаются соседние блоки с одинаковым набором свойств.

### 1.2.3. Удаление перекрываемых свойств
#### Удаление перекрываемых свойств

@@ -334,3 +334,3 @@ Минимизация удалением перекрываемых свойств основана на том, что внутри блока применяется:

#### 1.2.3.1. Удаление перекрываемых shorthand свойств
##### Удаление перекрываемых shorthand свойств

@@ -354,3 +354,3 @@ Для свойств `border`, `margin`, `padding`, `font` и `list-style` используется следующий алгоритм удаления: если последним по порядку свойством является более 'широкое' свойство (например, `border`), то все предыдущие перекрываемые им свойства удаляются (например, `border-top-width` или `border-style`).

### 1.2.4. Удаление повторяющихся селекторов
#### Удаление повторяющихся селекторов

@@ -373,3 +373,3 @@ Повторяющиеся селекторы излишни и потому могут быть удалены.

### 1.2.5. Частичное слияние блоков
#### Частичное слияние блоков

@@ -444,3 +444,3 @@ Если рядом расположены блоки, один из которых набором свойств полностью входит в другой, возможна следующая минимизация:

### 1.2.6. Частичное разделение блоков
#### Частичное разделение блоков

@@ -517,3 +517,3 @@ Если рядом расположены блоки, частично пересекающиеся набором свойств, возможна следующая минимизация:

### 1.2.7. Удаление пустых ruleset и at-rule
#### Удаление пустых ruleset и at-rule

@@ -546,3 +546,3 @@ Пустые ruleset и at-rule удаляются.

### 1.2.8. Минимизация margin и padding
#### Минимизация margin и padding

@@ -655,3 +655,3 @@ Свойства `margin` и `padding` минимизируются согласно \[[CSS 2.1 / 8.3 Margin properties](http://www.w3.org/TR/CSS21/box.html#margin-properties)\] и \[[CSS 2.1 / 8.4 Padding properties](http://www.w3.org/TR/CSS21/box.html#padding-properties)\].

### 1.2.9. Специальная минимизация псевдоклассов
#### Специальная минимизация псевдоклассов

@@ -666,3 +666,3 @@ Если в группе селекторов UA обнаружит неподдерживаемый селектор, он, согласно \[[CSS 3 / Selectors / 5. Groups of selectors](http://www.w3.org/TR/selectors/#grouping)\], посчитает неподдерживаемой всю группу и не применит стили к перечисленным в ней селекторам. Этим нередко пользуются для разграничения стилей по браузерам. Вот [пример](http://pornel.net/firefoxhack) метода:

#### 1.2.9.1. Сохранение группы
##### Сохранение группы

@@ -713,3 +713,3 @@ В общем случае (исключения описаны ниже) минимизация удалением перекрываемого селектора не происходит, если группа селекторов включает псевдокласс или псевдоэлемент.

#### 1.2.9.2. Минимизация общеподдерживаемых псевдоклассов и псевдоэлементов
##### Минимизация общеподдерживаемых псевдоклассов и псевдоэлементов

@@ -740,3 +740,3 @@ Существуют псевдоклассы и псевдоэлементы, поддерживаемые большинством браузеров: `:link`, `:visited`, `:hover`, `:active`, `:first-letter`, `:first-line`. Для них минимизация происходит в общем порядке без сохранения группы.

#### 1.2.9.3. Минимизация :before и :after
##### Минимизация :before и :after

@@ -789,3 +789,3 @@ Псевдоэлементы `:before` и `:after` обычно поддерживаются браузерами парно, потому объединение блоков с их участием безопасно.

# 2. Рекомендации
## Рекомендации

@@ -796,11 +796,11 @@ С точки зрения минимизации таблицы стилей можно разделить на две группы: удобные и неудобные. Разница даже в один символ может превратить вполне сокращаемый исходный текст в минимально обрабатываемый.

## 2.1. Длина селекторов
### Длина селекторов
Чем короче селектор (whitespace не учитываются), тем больше вероятность удачного группирования.
## 2.2. Порядок свойств
### Порядок свойств
Придерживайтесь во всём CSS одного порядка, в котором перечисляются свойства, так вам не потребуется защита от смены порядка. Соответственно, меньше вероятность допустить ошибку и помешать минимизатору излишним управлением.
## 2.3. Расположение схожих блоков
### Расположение схожих блоков

@@ -853,3 +853,3 @@ Располагайте блоки со схожим набором свойств как можно ближе друг к другу.

## 2.4. Использование !important
### Использование !important

@@ -856,0 +856,0 @@ Очевидно, `!important` оказывает серьёзное влияние на минимизацию, особенно заметно это может отразиться на минимизации `margin` и `padding`, потому им лучше не злоупотреблять.

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.
# Minification (in a nutshell)
## Minification (in a nutshell)

@@ -10,3 +10,3 @@ Safe transformations:

* Removal of comments
* Removal of invalid `@charset` и `@import` declarations
* Removal of invalid `@charset` and `@import` declarations
* Minification of color properties

@@ -29,5 +29,5 @@ * Minification of `0`

The minification techniques are described in detail in the [detailed description](/tools/csso/description/).
The minification techniques are described in detail in the [detailed description](../description/description.en.md).
# Authors
## Authors

@@ -40,11 +40,10 @@ * initial idea&nbsp;— Vitaly Harisov (<vitaly@harisov.name>)

# Feedback
## Feedback
Please report issues on [Github] (https://github.com/css/csso/issues).
Please report issues on [Github](https://github.com/css/csso/issues).
For feedback, suggestions, etc. write to <skryzhanovsky@ya.ru>.
# License
## License
* CSSO is licensed under [MIT](https://github.com/css/csso/blob/master/MIT-LICENSE.txt)

@@ -28,3 +28,3 @@ CSSO (CSSオプティマイザー)は、他とは違ったCSS縮小化ツールです。 一般的な縮小化テクニックに加えてCSSファイルの構造的な最適化も行うので、 他の縮小化ツールと比べてより軽量にすることが可能です。

縮小化テクニックの詳細は [detailed description](/tools/csso/description/) で解説されています。
縮小化テクニックの詳細は [detailed description](../description/description.ja.md) で解説されています。

@@ -41,3 +41,3 @@ # 著者

問題の報告は [Github] (https://github.com/css/csso/issues) まで。
問題の報告は [Github](https://github.com/css/csso/issues) まで。

@@ -49,3 +49,1 @@ フィードバック、提案、その他は <skryzhanovsky@ya.ru> まで。

* CSSOは [MIT](https://github.com/css/csso/blob/master/MIT-LICENSE.txt) ライセンスに基づいています。

@@ -28,3 +28,3 @@ CSSO (CSS Optimizer)는 다른 CSS압축툴과는 다릅니다. 일반적인 압축 기법에 더불어 CSS파일의 구조를 최적화하여 다른 툴에 비해 더 작은 파일로 만들 수 있습니다.

최소화 기법의 상세한 내용은 [detailed description](/tools/csso/description/)에 있습니다.
최소화 기법의 상세한 내용은 [detailed description](../description/description.ko.md)에 있습니다.

@@ -41,3 +41,3 @@ # 저자

문제가 있을 경우 [Github] (https://github.com/css/csso/issues)에 올려주시기 바랍니다.
문제가 있을 경우 [Github](https://github.com/css/csso/issues)에 올려주시기 바랍니다.

@@ -49,3 +49,1 @@ 피드백, 제안 등은 <skryzhanovsky@ya.ru>로 전달바랍니다.

* CSSO는 [MIT](https://github.com/css/csso/blob/master/MIT-LICENSE.txt)라이센스를 따릅니다.
CSSO (CSS Optimizer) является минимизатором CSS, выполняющим как минимизацию без изменения структуры, так и структурную минимизацию с целью получить как можно меньший текст.
# Минимизация (кратко)
## Минимизация (кратко)

@@ -28,5 +28,5 @@ Минимизация без изменения структуры:

Подробнее смотри в [детальном описании](/tools/csso/description/) минимизации.
Подробнее смотрите в [детальном описании](../description/description.ru.md) минимизации.
# Авторы
## Авторы

@@ -38,3 +38,3 @@ * идея и поддержка&nbsp;— Виталий Харисов (<vitaly@harisov.name>)

# Обратная связь
## Обратная связь

@@ -45,5 +45,4 @@ Замеченные ошибки лучше добавлять в [Issues](https://github.com/css/csso/issues) проекта.

# Лицензия
## Лицензия
* CSSO распространяется под [лицензией MIT](https://github.com/css/csso/blob/master/MIT-LICENSE.txt)

@@ -1,7 +0,9 @@

# Install using npm
# CSSO installation
## Install using npm
Prerequisites:
* nodejs 0.4.x&nbsp;— [http://nodejs.org](http://nodejs.org)
* npm&nbsp;— [http://github.com/isaacs/npm/](http://github.com/isaacs/npm/)
* [NodeJS 0.8.x](http://nodejs.org)
* [npm](http://github.com/isaacs/npm/)

@@ -20,7 +22,7 @@ To install (global):

# Install using git
## Install using git
Prerequisites:
* git&nbsp;— [http://git-scm.com/](http://git-scm.com/)
* [git](http://git-scm.com/)

@@ -27,0 +29,0 @@ To install:

@@ -1,7 +0,9 @@

# Установка с помощью npm
# Установка CSSO
## Установка с помощью npm
Предварительные требования:
* nodejs версии 0.4.x&nbsp;— [http://nodejs.org](http://nodejs.org)
* npm&nbsp;— [http://github.com/isaacs/npm/](http://github.com/isaacs/npm/)
* [NodeJS 0.8.x](http://nodejs.org)
* [npm](http://github.com/isaacs/npm/)

@@ -20,7 +22,7 @@ Установка (глобально):

# Установка с помощью git
## Установка с помощью git
Предварительные требования:
* git&nbsp;— [http://git-scm.com/](http://git-scm.com/)
* [git](http://git-scm.com/)

@@ -27,0 +29,0 @@ Установка:

@@ -1,10 +0,10 @@

# In the browser
## In the browser
Open [http://css.github.com/csso/csso.html](http://css.github.com/csso/csso.html) in your browser.
Use a [browser vesion of CSSO](http://css.github.com/csso/csso.html) to minimize your code.
**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.**
# From the command line
## From the command line
Run `bin/csso` (when installed from git), you will need to have nodejs 0.4.x installed&nbsp;— [http://nodejs.org](http://nodejs.org)
Run `bin/csso` (when installed from git), [NodeJS](http://nodejs.org) 0.8.x is required.

@@ -39,3 +39,3 @@ Run `csso` (when installed from npm).

# As an npm module
## As an npm module

@@ -42,0 +42,0 @@ Sample (`test.js`):

@@ -1,10 +0,10 @@

# Через браузер
## Через браузер
Открыть в браузере [http://css.github.com/csso/csso.html](http://css.github.com/csso/csso.html).
Вы можете использовать [браузерную версию CSSO](http://css.github.com/csso/csso.html) для оптимизации кода.
**Работа CSSO в браузерах не гарантирована. Рекомендуемый путь использования этой утилиты&nbsp;— использование из командной строки или npm-модулей.**
# Через командную строку
## Через командную строку
При git-установке запускать `bin/csso`, но в таком случае потребуется nodejs версии 0.4.x&nbsp;— [http://nodejs.org](http://nodejs.org)
При git-установке необходимо запустить `bin/csso`, но в таком случае вам потребуется [NodeJS](http://nodejs.org) версии 0.8.x.

@@ -39,3 +39,3 @@ При npm-установке запускать `csso`.

# Через npm-модуль (при установке с помощью npm)
## Через npm-модуль (при установке с помощью npm)

@@ -42,0 +42,0 @@ Пример (`test.js`):

@@ -119,6 +119,12 @@ function TRBL(name, imp) {

var s = this.sides,
imp;
imp,
ieReg = /\\9$/;
if (!!(s.top && s.right && s.bottom && s.left)) {
imp = s.top.imp + s.right.imp + s.bottom.imp + s.left.imp;
if (ieReg.test(s.top.s) || ieReg.test(s.right.s) || ieReg.test(s.bottom.s) || ieReg.test(s.left.s)) {
return false;
}
return (imp === 0 || imp === 4 || imp === this.imp);

@@ -168,2 +174,3 @@ }

};
var NON_LENGTH_UNIT = ['deg', 'grad', 'rad', 'turn', 's', 'ms', 'Hz', 'kHz', 'dpi', 'dpcm', 'dppx'];

@@ -710,3 +717,3 @@ function CSSOCompressor() {}

else {
if (!(container[1] === 'atrulerq' && !pr) && !this.issue16(container, i) && !this.issue165(container, pr, nr)) {
if (!(container[1] === 'atrulerq' && !pr) && !this.issue16(container, i) && !this.issue165(container, pr, nr) && !this.issue134(pr, nr)) {
if (nr !== null && pr !== null) {

@@ -733,2 +740,7 @@ if (this._cleanWhitespace(nr, false) || this._cleanWhitespace(pr, true)) return null;

//See https://github.com/css/csso/issues/134
CSSOCompressor.prototype.issue134 = function(pr, nr) {
return pr === 'funktion' && (nr === 'funktion' || nr === 'vhash');
};
CSSOCompressor.prototype._cleanWhitespace = function(r, left) {

@@ -879,10 +891,8 @@ switch(r) {

CSSOCompressor.prototype.compressDimension = function(token) {
var declaration;
if (token[2][2] === '0') {
if ((token[3][2] === 's' || token[3][2] === 'ms') && (declaration = this.findDeclaration(token))) {
var declName = declaration[2][2][2];
if (declName === '-moz-transition' || declName === 'transition') return; // https://github.com/css/csso/issues/82, also support recent Fx versions
if (declName === '-moz-animation' || declName === 'animation') return; // https://github.com/css/csso/issues/100
}
return token[2];
if (NON_LENGTH_UNIT.indexOf(token[3][2]) >= 0) {
return;
}
return token[2]
}

@@ -889,0 +899,0 @@ };

var fs = require('fs'),
print = require('util').print,
csso = require('./cssoapi.js'),
src, x;
src;

@@ -26,5 +25,5 @@ var args = process.argv.slice(2),

if (single && single.contains(['-v', '--version'])) {
printFile('VERSION');
console.log(require(__dirname + '/../package.json').version);
} else if (!inFile || !opts || (single && single.contains(['-h', '--help'])) || other.length > 2) {
printFile('USAGE');
console.log(fs.readFileSync(__dirname + '/../USAGE', 'utf-8'));
} else {

@@ -35,3 +34,3 @@ src = fs.readFileSync(inFile).toString().trim();

else {
if (!outFile) print(csso.justDoIt(src, ro, true));
if (!outFile) console.log(csso.justDoIt(src, ro, true));
else fs.writeFileSync(outFile, csso.justDoIt(src, ro, true));

@@ -69,5 +68,1 @@ }

}
function printFile(filename) {
print(fs.readFileSync(__dirname.slice(0, __dirname.lastIndexOf('/')) + '/' + filename).toString());
}
{
"name": "csso",
"description": "CSSO — CSS optimizer",
"version": "1.3.11",
"version": "1.3.12",
"homepage": "https://github.com/css/csso",

@@ -20,6 +20,6 @@ "author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (https://github.com/afelix)",

"scripts": {
"test": "mocha ./test/test.js"
"test": "mocha --reporter dot"
},
"devDependencies": {
"mocha": "~1.16.2"
"mocha": "~2.3.3"
},

@@ -26,0 +26,0 @@ "engines": {

@@ -1,3 +0,3 @@

[![Build Status](https://travis-ci.org/css/csso.png?branch=master)](https://travis-ci.org/css/csso)
[![devDependency Status](https://david-dm.org/css/csso/dev-status.png?theme=shields.io)](https://david-dm.org/css/csso#info=devDependencies)
[![NPM version](https://img.shields.io/npm/v/csso.svg)](https://www.npmjs.com/package/csso)
[![Build Status](https://travis-ci.org/css/csso.svg?branch=master)](https://travis-ci.org/css/csso)

@@ -8,3 +8,3 @@ # English

See detailed information on [bem.info/tools/csso](http://bem.info/tools/csso/).
See detailed information on [bem.info/tools/optimizers/csso](https://bem.info/tools/optimizers/csso/).

@@ -15,3 +15,3 @@ # 中文

访问[bem.info/tools/csso](http://bem.info/tools/csso/)获取更详细的信息。
访问[bem.info/tools/optimizers/csso](https://bem.info/tools/optimizers/csso/)获取更详细的信息。

@@ -22,3 +22,3 @@ # 日本語

詳細な情報は[bem.info/tools/csso](http://bem.info/tools/csso/)を参照してください。
詳細な情報は[bem.info/tools/optimizers/csso](https://bem.info/tools/optimizers/csso/)を参照してください。

@@ -29,4 +29,10 @@ # Русский

Детальное описание смотри на [ru.bem.info/tools/csso](http://ru.bem.info/tools/csso/).
Детальное описание смотри на [ru.bem.info/tools/optimizers/csso](https://ru.bem.info/tools/optimizers/csso/).
# Українська
CSSO (CSS Optimizer) є CSS-мінімізатор не схожий на інші. На додачу до звичайних технік мініфікації він може виконувати й структурну оптимізацію файлів CSS, що дозволяє отримати менший розмір файлу, в порівнянні з іншими мініфікаторами.
Детальнішу інформацію шукайте на [bem.info/tools/optimizers/csso](https://bem.info/tools/optimizers/csso/).
# 한국어

@@ -36,3 +42,3 @@

상세한 정보는 [bem.info/tools/csso](http://bem.info/tools/csso/)를 참고바랍니다.
상세한 정보는 [bem.info/tools/optimizers/csso](https://bem.info/tools/optimizers/csso/)를 참고바랍니다.

@@ -39,0 +45,0 @@ <!-- Yandex.Metrika counter -->

@@ -0,1 +1,2 @@

var NON_LENGTH_UNIT = ['deg', 'grad', 'rad', 'turn', 's', 'ms', 'Hz', 'kHz', 'dpi', 'dpcm', 'dppx'];

@@ -542,3 +543,3 @@ function CSSOCompressor() {}

else {
if (!(container[1] === 'atrulerq' && !pr) && !this.issue16(container, i)) {
if (!(container[1] === 'atrulerq' && !pr) && !this.issue16(container, i) && !this.issue165(container, pr, nr) && !this.issue134(pr, nr)) {
if (nr !== null && pr !== null) {

@@ -560,2 +561,12 @@ if (this._cleanWhitespace(nr, false) || this._cleanWhitespace(pr, true)) return null;

//See https://github.com/css/csso/issues/165
CSSOCompressor.prototype.issue165 = function(container, pr, nr) {
return container[1] === 'atrulerq' && pr === 'braces' && nr === 'ident';
};
//See https://github.com/css/csso/issues/134
CSSOCompressor.prototype.issue134 = function(pr, nr) {
return pr === 'funktion' && (nr === 'funktion' || nr === 'vhash');
};
CSSOCompressor.prototype._cleanWhitespace = function(r, left) {

@@ -681,2 +692,8 @@ switch(r) {

}
// check if color is followed by number
var parent = token[0].parent;
var parentIx = parent.indexOf(token);
var appendSpace = parent[parentIx + 1] && parent[parentIx + 1][1] != 's';
if (v.length === 3) {

@@ -686,3 +703,12 @@ h += (t = Number(v[0][2]).toString(16)).length === 1 ? '0' + t : t;

h += (t = Number(v[2][2]).toString(16)).length === 1 ? '0' + t : t;
if (h.length === 6) return this._compressHashColor(h, {});
if (h.length === 6) {
var vhash = this._compressHashColor(h, {});
if (appendSpace) {
// che: I guess this is not right: modify color token with
// indentation, but I can't find any better solution right now
vhash[2] += ' ';
}
return vhash;
}
}

@@ -693,10 +719,8 @@ }

CSSOCompressor.prototype.compressDimension = function(token) {
var declaration;
if (token[2][2] === '0') {
if (token[3][2] === 's' && (declaration = this.findDeclaration(token))) {
var declName = declaration[2][2][2];
if (declName === '-moz-transition') return; // https://github.com/css/csso/issues/82
if (declName === '-moz-animation' || declName === 'animation') return; // https://github.com/css/csso/issues/100
}
return token[2];
if (NON_LENGTH_UNIT.indexOf(token[3][2]) >= 0) {
return;
}
return token[2]
}

@@ -703,0 +727,0 @@ };

@@ -119,6 +119,12 @@ function TRBL(name, imp) {

var s = this.sides,
imp;
imp,
ieReg = /\\9$/;
if (!!(s.top && s.right && s.bottom && s.left)) {
imp = s.top.imp + s.right.imp + s.bottom.imp + s.left.imp;
if (ieReg.test(s.top.s) || ieReg.test(s.right.s) || ieReg.test(s.bottom.s) || ieReg.test(s.left.s)) {
return false;
}
return (imp === 0 || imp === 4 || imp === this.imp);

@@ -125,0 +131,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc