clean-css.git
7 years agoSee #290 - removes aggressive merging.
Jakub Pawlowicz [Wed, 18 Jan 2017 06:51:39 +0000 (07:51 +0100)]
See #290 - removes aggressive merging.

Why:

* Aggressive merging was replaced by override merging;
* it supports much more properties now so aggressive merging won't
  be missed;
* it also overrides based on understandability not merely a
  position in output file.

Side notes:

* This is a safe change as if a property is not configured to
  be overridable it won't be;
* overhauls `canOverride` functionality to prevent features like
  vendor prefixes or variables from overriding widely supported
  values;
* overhauls validating values by allowing known values, which
  strictly doesn't make it a full validator but rather a way
  of telling if a value *may* be valid.

7 years agoSee #290 - reworks `border` overriding.
Jakub Pawlowicz [Mon, 16 Jan 2017 07:38:46 +0000 (08:38 +0100)]
See #290 - reworks `border` overriding.

Why:

* Border is a complex case where both `border` and all its
  components: `border-color`, `border-style`, and `border-width`
  are components. Also `border-(bottom|left|right|top)` are
  shorthands too.
* this commit restores aggressive merging shorthand overriding right
  inside shorthand compacting code.

7 years agoSee #290 - disables `font` shorthand overriding.
Jakub Pawlowicz [Sun, 15 Jan 2017 11:14:26 +0000 (12:14 +0100)]
See #290 - disables `font` shorthand overriding.

Why:

* It's a shorthand property, so not straightforward to implement
  in shorthand/override compacting;
* pending in #254.

7 years agoSee #290 - disables `transition` shorthand overriding.
Jakub Pawlowicz [Sun, 15 Jan 2017 11:11:38 +0000 (12:11 +0100)]
See #290 - disables `transition` shorthand overriding.

Why:

* It's a shorthand property, so not straightforward to implement
  in shorthand/override compacting;
* pending in #861.

7 years agoSee #290 - disables `animation` shorthand overriding.
Jakub Pawlowicz [Sun, 15 Jan 2017 11:08:19 +0000 (12:08 +0100)]
See #290 - disables `animation` shorthand overriding.

Why:

* It's a shorthand property, so not straightforward to implement
  in shorthand/override compacting;
* pending in #860.

7 years agoSee #857 - removes redundant source map code.
Jakub Pawlowicz [Sun, 15 Jan 2017 11:25:15 +0000 (12:25 +0100)]
See #857 - removes redundant source map code.

Thanks to @alexlamsl for spotting it.

Why:

* Tracking input source map is done in #minify method already.

7 years agoFixes #857 - normalizes CleanCSS API interface.
Jakub Pawlowicz [Sun, 15 Jan 2017 10:28:13 +0000 (11:28 +0100)]
Fixes #857 - normalizes CleanCSS API interface.

Why:

* `sourceMap` option has to be a boolean now;
* input source map can be passed as a 2nd argument to `minify`
  method, making callback a 3rd;
* all other options are stateless so should be the `sourceMap`.

7 years agoRefactors validator into a set of functions.
Jakub Pawlowicz [Sat, 14 Jan 2017 21:35:28 +0000 (22:35 +0100)]
Refactors validator into a set of functions.

Why:

* There's no need to keep it as an object, since configuration
  can also be passed in.

7 years agoSee #799 - speeds up serializing code.
Jakub Pawlowicz [Sat, 14 Jan 2017 10:30:04 +0000 (11:30 +0100)]
See #799 - speeds up serializing code.

Why:

* Instead of using an `if` branch implements wrapping and tracking
  as a callback with `no-op` implementation when wrapping is disabled.

7 years agoSee #799 - adds an option to wrap output at arbitrary column.
Jakub Pawlowicz [Sat, 14 Jan 2017 10:19:41 +0000 (11:19 +0100)]
See #799 - adds an option to wrap output at arbitrary column.

Why:

* As not all clients (i.e. email clients) like CSS in one line.

7 years agoSee #799 - changes formatting defaults.
Jakub Pawlowicz [Fri, 13 Jan 2017 22:46:17 +0000 (23:46 +0100)]
See #799 - changes formatting defaults.

Why:

* When formatting is turned on it defaults to no formatting, so
  any options need to be applied on top of these;
* adds `beautify` preset for the previous default, e.g.
  `cleancss --format beautify one.css`.

7 years agoSee #799 - renames `beautify` option to `format`.
Jakub Pawlowicz [Fri, 13 Jan 2017 11:05:39 +0000 (12:05 +0100)]
See #799 - renames `beautify` option to `format`.

Why:

* It makes more sense as it controls formatting in general;
* see #209 where `beautify` was introduced.

7 years agoSee #799 - adds granular formatting options.
Jakub Pawlowicz [Thu, 12 Jan 2017 21:55:16 +0000 (22:55 +0100)]
See #799 - adds granular formatting options.

Why:

* To allow better control over how output is formatted;
* also gets rid of `keepBreaks` option in favor to
  `{ beautify: 'keep-breaks' }` shortcut.

7 years agoSee #773 - speeds up specificity lookup.
Jakub Pawlowicz [Wed, 11 Jan 2017 19:20:25 +0000 (20:20 +0100)]
See #773 - speeds up specificity lookup.

Why:

* Calculating it is slow, but, since it's done repeatedly for
  the same selectors, it can be cached quite effectively.

7 years agoFixes #773 - adds reordering based on selector specificity.
Jakub Pawlowicz [Wed, 11 Jan 2017 17:20:00 +0000 (18:20 +0100)]
Fixes #773 - adds reordering based on selector specificity.

Why:

* Rules with different specificity can be safely reordered as those
  with higher value will always override those with lower;
* there is no way to determine whether the latter can be ignored
  because HTML context is not known;
* this is a level 2 optimization which are off by default.

7 years agoSee #425 - nitpicking natural sorting algorithm.
Jakub Pawlowicz [Wed, 11 Jan 2017 07:40:03 +0000 (08:40 +0100)]
See #425 - nitpicking natural sorting algorithm.

Thanks to @alexlamsl for spotting these.

7 years agoFixes #425 - enables natural method of sorting selectors.
Jakub Pawlowicz [Tue, 10 Jan 2017 17:04:07 +0000 (18:04 +0100)]
Fixes #425 - enables natural method of sorting selectors.

Still defaults to standard sorting but natural becomes
a new option. Controlled via `selectorsSortingMethod`
option in level 1 optimizations.

Why:

* Natural way could be a more compression-efficient way;
* it's easier to read for a human.

7 years agoSee #425 - adds natural sorting algorithm.
Jakub Pawlowicz [Thu, 5 Jan 2017 11:35:17 +0000 (12:35 +0100)]
See #425 - adds natural sorting algorithm.

Why:

* We need it to sort selectors accordingly.

7 years agoAlways run CI on Node.js 7 too.
Jakub Pawlowicz [Wed, 11 Jan 2017 07:43:39 +0000 (08:43 +0100)]
Always run CI on Node.js 7 too.

At this moment it's a current version of Node.js so it'd be good
to run tests on it.

See: https://github.com/nodejs/LTS

7 years agoFixes #853 - renames level 2 options.
Jakub Pawlowicz [Tue, 10 Jan 2017 13:39:51 +0000 (14:39 +0100)]
Fixes #853 - renames level 2 options.

Why:

* To match level 1 wording which feels more natural.

7 years agoRestores proper multiple level handling in CLI.
Jakub Pawlowicz [Tue, 10 Jan 2017 12:42:35 +0000 (13:42 +0100)]
Restores proper multiple level handling in CLI.

Why:

* Apparently the earlier change to a single dash option
  broke using multiple optimization levels at once.
  This commit restores it.

7 years agoAdds examples of `all` keyword in level 1/2 optimizations.
Jakub Pawlowicz [Tue, 10 Jan 2017 11:11:22 +0000 (12:11 +0100)]
Adds examples of `all` keyword in level 1/2 optimizations.

Why:

* So the option is documented properly.

7 years agoAllows `all` shortcut in level 1 optimizations config.
Jakub Pawlowicz [Tue, 10 Jan 2017 11:05:27 +0000 (12:05 +0100)]
Allows `all` shortcut in level 1 optimizations config.

Why:

* To enable/disable all options at once;
* note non-boolean options are ignored when `all` / `*` is used.

7 years agoInverts some level 1 options for consistency.
Jakub Pawlowicz [Tue, 10 Jan 2017 10:09:48 +0000 (11:09 +0100)]
Inverts some level 1 options for consistency.

@alexlamsl made a good point that when we have `all` shortcut,
to set all options at once, it'd be good if value given would
mean the same to all options.

7 years agoAdds granular control over level 1 optimizations.
Jakub Pawlowicz [Mon, 9 Jan 2017 14:17:39 +0000 (15:17 +0100)]
Adds granular control over level 1 optimizations.

Why:

* So users can turn them on/off selectively;
* still keeping sane defaults for most users.

Note: moves `properties.fontWeight` compatibility flag to level 1
optimizations as that's not a compatibility flag, but rather a
user preference - see #756.

7 years agoRenames level 1 optimizations test file.
Jakub Pawlowicz [Mon, 9 Jan 2017 20:36:15 +0000 (21:36 +0100)]
Renames level 1 optimizations test file.

7 years agoReorganizes level 1 optimizations.
Jakub Pawlowicz [Mon, 9 Jan 2017 13:48:34 +0000 (14:48 +0100)]
Reorganizes level 1 optimizations.

Why:

* Slightly more coherent now, will get more love in 4.1.

7 years agoSee #731 - adds granular control over level 2 optimizations.
Jakub Pawlowicz [Mon, 9 Jan 2017 12:52:43 +0000 (13:52 +0100)]
See #731 - adds granular control over level 2 optimizations.

Why:

* So users can selectively disable certain optimizations if they
  want to.

7 years agoRuns benchmark on each optimization level.
Jakub Pawlowicz [Mon, 9 Jan 2017 10:52:12 +0000 (11:52 +0100)]
Runs benchmark on each optimization level.

7 years agoSee #791 - normalizes stored paths.
Jakub Pawlowicz [Mon, 9 Jan 2017 09:44:51 +0000 (10:44 +0100)]
See #791 - normalizes stored paths.

Stores all paths internally as normalized to *nix format but
still outputs Windows friendly paths if needed.

`source-map` does it internally so there's no need to transform
paths in source maps.

7 years agoReorganizes optimizer around levels.
Jakub Pawlowicz [Sun, 8 Jan 2017 17:04:18 +0000 (18:04 +0100)]
Reorganizes optimizer around levels.

Why:

* Gets rid of the flat structure where levels' code was mixed;
* moves level 2 compacting into a namespace (folderspace?).

7 years agoSee #807 - disables restructuring optimizations.
Jakub Pawlowicz [Sun, 8 Jan 2017 11:09:50 +0000 (12:09 +0100)]
See #807 - disables restructuring optimizations.

Can be brought back with:

* `{ level: { 2: { restructuring: true } } }` in API;
* `-O2 restructuring:on` in CLI.

Why:

* Those can be slow on big files;
* Need further optimizations and code cleanup, see #533.

7 years agoSee #842 - removes HTML comments from selectors.
Alex Lam S.L [Sun, 8 Jan 2017 10:36:26 +0000 (11:36 +0100)]
See #842 - removes HTML comments from selectors.

Kudos to @alexlamsl for the fix.

Why:

* Apparently anything wrapped between HTML comments still gets
  processed by browsers.

7 years agoSee #850 - restores `-On` CLI option.
Jakub Pawlowicz [Sun, 8 Jan 2017 09:52:37 +0000 (10:52 +0100)]
See #850 - restores `-On` CLI option.

Thanks @alexlamsl for figuring it out!

7 years agoFixes #717 - makes level 1 optimizations default.
Jakub Pawlowicz [Fri, 6 Jan 2017 13:26:12 +0000 (14:26 +0100)]
Fixes #717 - makes level 1 optimizations default.

Why:

* This way is safer for end user;
* Leaves level 2 optimizations up to end user to test and decide if
  the end result is good enough.

7 years agoFixes #836 - enables level `0` optimizations.
Jakub Pawlowicz [Fri, 6 Jan 2017 12:56:24 +0000 (13:56 +0100)]
Fixes #836 - enables level `0` optimizations.

Why:

* Some people may need to bundle and rebase CSS without applying
  any optimizations.

7 years agoSee #850 - allows `on` or `off` as level option values.
Jakub Pawlowicz [Fri, 6 Jan 2017 11:26:18 +0000 (12:26 +0100)]
See #850 - allows `on` or `off` as level option values.

Why:

* In CLI mode it makes more sense to use these instead of `true`
  or `false` as in API (JavaScript) context.

7 years agoSee #850 - cleans up optimization level code.
Jakub Pawlowicz [Fri, 6 Jan 2017 11:18:47 +0000 (12:18 +0100)]
See #850 - cleans up optimization level code.

Why:

* For better readability.

7 years agoSee #850 - allows overriding all options.
Jakub Pawlowicz [Fri, 6 Jan 2017 10:56:57 +0000 (11:56 +0100)]
See #850 - allows overriding all options.

Why:

* Use `all` or `*` to reset all options to a given value.

Example:

```js
new CleanCSS({
  level: {
    2: {
      all: false,
      mediaMerging: true
    }
  }
});
```

7 years agoFixes #850 - implements optimization levels.
Jakub Pawlowicz [Thu, 5 Jan 2017 22:14:26 +0000 (23:14 +0100)]
Fixes #850 - implements optimization levels.

Why:

* To logically split optimizations into three groups - level 0
  (not implemented yet), level 1, and level 2 (default);
* To allow more fine-grained control over what's optimized on
  each level (pending);
* To have a future-proof way of setting it for both API & CLI.

7 years agoRemoves `benchmark` API option.
Jakub Pawlowicz [Thu, 5 Jan 2017 13:46:02 +0000 (14:46 +0100)]
Removes `benchmark` API option.

Why:

* total time is reported under `stats`;
* it was seriously impaired since optimizing got encapsulated
  and not invoked directly from lib/clean.js.

7 years agoFixed #828 - `-chrome-` hack support.
Jakub Pawlowicz [Wed, 4 Jan 2017 21:22:05 +0000 (22:22 +0100)]
Fixed #828 - `-chrome-` hack support.

Why:

* It was incorrectly handled by property extractor.

7 years agoFixes #460 - unescaped semicolon in selector.
Jakub Pawlowicz [Wed, 4 Jan 2017 20:24:26 +0000 (21:24 +0100)]
Fixes #460 - unescaped semicolon in selector.

Why:

* Such rules should be dropped. Warnings are already in place.

7 years agoFixes #806 - skip optimizing variable properties.
Jakub Pawlowicz [Wed, 4 Jan 2017 17:43:50 +0000 (18:43 +0100)]
Fixes #806 - skip optimizing variable properties.

Why:

* So far it's impossible to find out real property values so
  breaking up shorthands into components doesn't work.
* In theory one could optimize cases where all component values
  are given and one of them is a variable, but it's an additional
  complexity probably not worth the hassle.

7 years agoSee #796 - adds missing History.md entry.
Jakub Pawlowicz [Wed, 4 Jan 2017 17:09:44 +0000 (18:09 +0100)]
See #796 - adds missing History.md entry.

7 years agoReuses `rulesOverlap` helper.
Jakub Pawlowicz [Wed, 4 Jan 2017 17:06:29 +0000 (18:06 +0100)]
Reuses `rulesOverlap` helper.

Why:

* It's used in more than one place and the code was not reused.

7 years agoFixes #796 - enables semantic merging for `@media` blocks.
Jakub Pawlowicz [Tue, 3 Jan 2017 16:37:56 +0000 (17:37 +0100)]
Fixes #796 - enables semantic merging for `@media` blocks.

* It's off by default and can be enabled via `semanticMerging` flag;
* Handles all cases and BEM classes.

7 years agoSee #689 - fixes regression in parsing property blocks.
Jakub Pawlowicz [Wed, 4 Jan 2017 15:23:05 +0000 (16:23 +0100)]
See #689 - fixes regression in parsing property blocks.

Why:

* New tokenizer introduced an issue where a semicolon ending a
  property block was handled incorrectly.

7 years agoFixes a bug ignoring incorrect properties in complex restructuring.
Jakub Pawlowicz [Sun, 1 Jan 2017 11:45:33 +0000 (12:45 +0100)]
Fixes a bug ignoring incorrect properties in complex restructuring.

Why:

* Apparently there was a wrong value returned from sorting callback
  which only manifested in complex stylesheets being restructured.

7 years agoSee #290 - allows `font-weight` overriding.
Jakub Pawlowicz [Sun, 1 Jan 2017 11:25:57 +0000 (12:25 +0100)]
See #290 - allows `font-weight` overriding.

Why:

* Another step to move away from aggressive merging.

7 years agoSee #290 - allows `height` overriding.
Jakub Pawlowicz [Sun, 1 Jan 2017 11:19:47 +0000 (12:19 +0100)]
See #290 - allows `height` overriding.

Why:

* Another step to move away from aggressive merging.

7 years agoFixes #750 - allows `width` overriding.
Jakub Pawlowicz [Sat, 31 Dec 2016 18:02:31 +0000 (19:02 +0100)]
Fixes #750 - allows `width` overriding.

Why:

* Width can be overriden easily using `unit` overrider.

7 years agoSee #829 - another performance optimization.
Jakub Pawlowicz [Sat, 31 Dec 2016 10:34:32 +0000 (11:34 +0100)]
See #829 - another performance optimization.

Why:

* Well, if a selector doesn't have a colon there is no point
  looking for any pseudo classes/elements.

7 years agoSee #829 - fixes a typo in method name.
Jakub Pawlowicz [Fri, 30 Dec 2016 21:55:20 +0000 (22:55 +0100)]
See #829 - fixes a typo in method name.

7 years agoSee #829 - some performance tweaks.
Jakub Pawlowicz [Fri, 30 Dec 2016 21:50:09 +0000 (22:50 +0100)]
See #829 - some performance tweaks.

Why:

* Uses flat loops instead of callbacks;
* Checks for number of matches before invoking costly calculations.

7 years agoFixes #829 - adds more strict selector merging rules.
Jakub Pawlowicz [Fri, 30 Dec 2016 21:23:29 +0000 (22:23 +0100)]
Fixes #829 - adds more strict selector merging rules.

Why:

* Instead of blacklisting unmergeable selectors we're now
  whitelisting the valid ones and reject all other.

7 years agoFixes #739 - error when a closing brace is missing.
Jakub Pawlowicz [Fri, 30 Dec 2016 11:49:02 +0000 (12:49 +0100)]
Fixes #739 - error when a closing brace is missing.

Why:

* When such content gets parsed into a block we should ignore
  the whole declaration as browsers do.

7 years agoSee #703 - adds `ie11` alias to default compatibility.
Jakub Pawlowicz [Fri, 30 Dec 2016 10:47:05 +0000 (11:47 +0100)]
See #703 - adds `ie11` alias to default compatibility.

7 years agoSee #703 - re-enables `background` longhand merging.
Jakub Pawlowicz [Fri, 30 Dec 2016 06:40:08 +0000 (07:40 +0100)]
See #703 - re-enables `background` longhand merging.

Why:

* See #577 and #579 - these two clearly state the issue is about
  IE8 not IE9+, and according to tests and caniuse.com tables
  using `background-(clip|origin|size)` in `background` shorthand
  is supported on IE9+;
* At this point I have no idea why it was disabled at the time.
  One idea is that it was disabled because IE9 doesn't support
  `properties.spaceAfterClosingBrace` and these two issues
  overlappedi at the time of 3.2 branch. (both were "fixed" in 3.3);
* Let's enable it again, since the default mode is now IE10+.

** Important note **: Safari <7 and Android stock browser <4.4
does not support it either so you'll likely have to disable if
you still support those. Just use `--compatibility ie8` to do so.

Test case: https://jsfiddle.net/7zLwv7o0/5/

7 years agoSee #703 - adds `ie10` alias to default compatibility.
Jakub Pawlowicz [Thu, 29 Dec 2016 11:32:52 +0000 (12:32 +0100)]
See #703 - adds `ie10` alias to default compatibility.

7 years agoSee #703 - changes default compatibility to IE10+.
Jakub Pawlowicz [Tue, 27 Dec 2016 20:15:10 +0000 (21:15 +0100)]
See #703 - changes default compatibility to IE10+.

Why:

* It's high time to move it up as IE9 is relatively old now.
* Adds `ie9` compatibility mode to make it easy to go back
  to 3.x default.

7 years agoSimplifies compatibility mode definitions.
Jakub Pawlowicz [Tue, 27 Dec 2016 15:51:40 +0000 (16:51 +0100)]
Simplifies compatibility mode definitions.

Why:

* Using inheritance it's clear which properties change.

7 years agoFixes #785 - adds `@font-face` de-duplication.
Jakub Pawlowicz [Tue, 27 Dec 2016 14:12:28 +0000 (15:12 +0100)]
Fixes #785 - adds `@font-face` de-duplication.

Why:

* Extra `@font-face` rules can be safely removed.
* There's no API/CLI switch to turn it off as it's pending
  a refactoring in v4 - see #842.

7 years agoSee #801 - adds History.md entry.
Jakub Pawlowicz [Tue, 27 Dec 2016 13:39:15 +0000 (14:39 +0100)]
See #801 - adds History.md entry.

7 years agoSee #801 - recommends clean-css styles concatenation.
Jakub Pawlowicz [Tue, 27 Dec 2016 13:31:10 +0000 (14:31 +0100)]
See #801 - recommends clean-css styles concatenation.

Why:

* There is a difference between passing in a concatenated string
  and letting clean-css do the job. The former will discard
  `@import` statements appearing not at the beginning of the string,
  while the latter will discard only those appearing not at
  the beginning of any of the files. Because of this behavior,
  the latter way is recommended.

7 years agoSee #801 - adds test cases to avoid regression.
Jakub Pawlowicz [Tue, 27 Dec 2016 13:10:08 +0000 (14:10 +0100)]
See #801 - adds test cases to avoid regression.

Why:

* It works as expected since 426127a, but there were no
  explicit tests for this feature.

7 years agoFixes #849 - disables inlining protocol-less resources.
Jakub Pawlowicz [Mon, 26 Dec 2016 15:30:35 +0000 (16:30 +0100)]
Fixes #849 - disables inlining protocol-less resources.

Why:

* It's not safe to assume a HTTP protocol;
* It's better to leave such resources to be resolved at runtime
  when stylesheets are interpreted inside a HTTP(S) context.

7 years agoSplits `inliner` option in two.
Jakub Pawlowicz [Mon, 26 Dec 2016 15:03:11 +0000 (16:03 +0100)]
Splits `inliner` option in two.

* `{ inliner: { request: ... } }` becomes `{ inlineRequest: ... }`;
* `{ inliner: { timeout: N } }` becomes `{ inlineTimeout: N }`;
* `--timeout` becomes `--inline-timeout`.

Why:

* To relate it directly to the new `inline` option.
* Also `--timeout` option relates to `@import` inlining only
  so it should not be "global".

7 years agoFixes #767 - refactors inlining options.
Jakub Pawlowicz [Mon, 26 Dec 2016 14:26:09 +0000 (15:26 +0100)]
Fixes #767 - refactors inlining options.

Merges `processImport` and `processImportFrom` API options into
a single `inline` option. It accepts the same set of rules as
`processImportFrom` previously, e.g.

`{ inline: 'none' }`
`{ inline: ['local', '127.0.0.1] }`

Also the `inline` option defaults to `local` now, which means
remote `@import` rules are **NOT** inlined by default anymore.
To re-enable it use any of the following:

`{ inline: 'all' }`
`{ inline: 'local,remote' }`

Why:

* These two options were meant to be merged as they represent the
  same concept;
* Inlining remote `@import` rules by default may not be desirable;
* "Inline" as the option name better represents what this option
  does, as it also applies to source maps.

7 years agoReworks inlining so resources are loaded lazily.
Jakub Pawlowicz [Mon, 26 Dec 2016 11:42:08 +0000 (12:42 +0100)]
Reworks inlining so resources are loaded lazily.

Why:

* when using a hash as an input, the sources it references
  should be processed lazily instead of a whole hash being
  serialized & tokenized eagerly.

This change addresses the need by:

* See #791 - in-memory imports require such lazy processing.
  The other way, we end up with duplicated rules, and have to rely
  on advanced processing to remove them.

7 years agoFixes #791 - resolves imports in-memory if possible.
Jakub Pawlowicz [Sun, 25 Dec 2016 14:38:04 +0000 (15:38 +0100)]
Fixes #791 - resolves imports in-memory if possible.

Why:

* When a hash is given as a source, some imports can be inlined
  in-memory taking styles from the hash.

7 years agoSee #710 - adds a test case to prevent regressions.
Jakub Pawlowicz [Fri, 23 Dec 2016 22:00:46 +0000 (23:00 +0100)]
See #710 - adds a test case to prevent regressions.

7 years agoSee #808 - adds a test case to prevent regressions.
Jakub Pawlowicz [Fri, 23 Dec 2016 21:00:43 +0000 (22:00 +0100)]
See #808 - adds a test case to prevent regressions.

7 years agoFixes #845 - fixes web compatibility in 4.0.
Jakub Pawlowicz [Fri, 23 Dec 2016 20:43:50 +0000 (21:43 +0100)]
Fixes #845 - fixes web compatibility in 4.0.

Why:

* 4.0 calculates stats by default but `process.hrtime` is not
  available inside browsers. However, since we don't need
  sub-ms resolution, `Date.now()` can be used instead.

7 years agoFixes #685 - adds lowercase hex color normalization.
Jakub Pawlowicz [Fri, 23 Dec 2016 19:54:45 +0000 (20:54 +0100)]
Fixes #685 - adds lowercase hex color normalization.

Why:

* This change does not affect color interpretation.
* Allow potential merging improvements as colors are normalized.

7 years agoSee #560 - adds a test case to prevent future regressions.
Jakub Pawlowicz [Fri, 23 Dec 2016 17:24:56 +0000 (18:24 +0100)]
See #560 - adds a test case to prevent future regressions.

7 years agoFixes #847 - ignores selectors with invalid characters.
Jakub Pawlowicz [Fri, 23 Dec 2016 17:05:17 +0000 (18:05 +0100)]
Fixes #847 - ignores selectors with invalid characters.

Why:

* Browsers won't apply such rules so neither should we.

7 years agoFixes #758 - ignores rules with empty selectors.
Jakub Pawlowicz [Thu, 22 Dec 2016 21:18:33 +0000 (22:18 +0100)]
Fixes #758 - ignores rules with empty selectors.

7 years agoFixes #817 - makes `off` disable rounding.
Jakub Pawlowicz [Thu, 22 Dec 2016 20:51:11 +0000 (21:51 +0100)]
Fixes #817 - makes `off` disable rounding.

Why:

* `-1` is still an alias to `off`.
* It won't be used that often as rounding is now disabled
  by default.

7 years agoSee #209 - adds missing readme for `beautify` option.
Jakub Pawlowicz [Thu, 22 Dec 2016 15:13:03 +0000 (16:13 +0100)]
See #209 - adds missing readme for `beautify` option.

7 years agoFixes #209 - adds output formatting via `beautify` option.
Jakub Pawlowicz [Thu, 22 Dec 2016 14:41:58 +0000 (15:41 +0100)]
Fixes #209 - adds output formatting via `beautify` option.

Why:

* So clean-css can be used to format CSS nicely as well.

7 years agoFixes tokenizer edge case.
Jakub Pawlowicz [Thu, 22 Dec 2016 07:59:41 +0000 (08:59 +0100)]
Fixes tokenizer edge case.

If there is a semicolon marker after a property then the property
ends and its reference should be discarded. Otherwise next tokens
may get appended to the property.

7 years agoFixed #432 - adds URLs normalization.
Jakub Pawlowicz [Wed, 21 Dec 2016 11:05:46 +0000 (12:05 +0100)]
Fixed #432 - adds URLs normalization.

Why:

* So further merging or compacting can happen more effectively
  even when initial URL formatting is different.

7 years agoFixes #756 - adds disabling font-weight optimizations.
Jakub Pawlowicz [Wed, 21 Dec 2016 10:46:14 +0000 (11:46 +0100)]
Fixes #756 - adds disabling font-weight optimizations.

Why:

* Some users reported a need to keep original values;
* Actually we want all optimizations to be configurable.

7 years agoSee #657 - adds missing History.md entry.
Jakub Pawlowicz [Wed, 21 Dec 2016 07:37:58 +0000 (08:37 +0100)]
See #657 - adds missing History.md entry.

7 years agoFixes #686 - adds rounding precision for all units.
Jakub Pawlowicz [Tue, 20 Dec 2016 14:47:53 +0000 (15:47 +0100)]
Fixes #686 - adds rounding precision for all units.

** BREAKING CHANGE ** - setting a rounding precision value to a
number applies it to *all* units now, not `px` only.

Why:

* To give users more control over how units are optimized.

7 years agoFixes #657 - adds property name validation.
Jakub Pawlowicz [Tue, 20 Dec 2016 16:10:47 +0000 (17:10 +0100)]
Fixes #657 - adds property name validation.

It's a bit relaxed matching but too strict one would do too much
harm with many false-positives.

Why:

* To prevent processing errors further down the optimization pipeline.

7 years agoStandardizes <file>:<line>:<column> formatting.
Jakub Pawlowicz [Tue, 20 Dec 2016 15:22:44 +0000 (16:22 +0100)]
Standardizes <file>:<line>:<column> formatting.

Why:

* When a warning is raised we should give user as much info as
  possible, which includes a filename, line and column number.

7 years agoFixes #818 - disables `px` rounding by default.
Jakub Pawlowicz [Mon, 19 Dec 2016 09:26:45 +0000 (10:26 +0100)]
Fixes #818 - disables `px` rounding by default.

Why:

* It is a safer default than `2` which may lead to some
  issues with Bootstrap and other CSS frameworks depending
  on a high-precision `px` values.

Also see #686 which will make rounding more flexible and
available to all units.

7 years agoRefactors batch-test.js.
Jakub Pawlowicz [Mon, 19 Dec 2016 09:58:25 +0000 (10:58 +0100)]
Refactors batch-test.js.

Why:

* Wasn't too DRY anymore.

7 years agoFixes #704 - adds batch CLI tests.
Jakub Pawlowicz [Mon, 19 Dec 2016 09:49:00 +0000 (10:49 +0100)]
Fixes #704 - adds batch CLI tests.

Why:

* To compare output generated by CLI and API (should be the same!).

7 years agoAdds link to official web interface to readme.
Jakub Pawlowicz [Mon, 19 Dec 2016 07:16:47 +0000 (08:16 +0100)]
Adds link to official web interface to readme.

7 years agoAdds Readme section on 4.0 breaking changes.
Jakub Pawlowicz [Mon, 19 Dec 2016 07:11:29 +0000 (08:11 +0100)]
Adds Readme section on 4.0 breaking changes.

7 years agoSee #789 - adds a test case to avoid future regressions.
Jakub Pawlowicz [Mon, 19 Dec 2016 06:53:29 +0000 (07:53 +0100)]
See #789 - adds a test case to avoid future regressions.

7 years agoSee #809 - adds a test case to avoid future regressions.
Jakub Pawlowicz [Mon, 19 Dec 2016 06:43:07 +0000 (07:43 +0100)]
See #809 - adds a test case to avoid future regressions.

7 years agoSee #786 - adds a test case to avoid future regressions.
Jakub Pawlowicz [Mon, 19 Dec 2016 06:39:24 +0000 (07:39 +0100)]
See #786 - adds a test case to avoid future regressions.

7 years agoFixes #834 - adds extra line break in nested blocks.
Jakub Pawlowicz [Sun, 18 Dec 2016 15:46:28 +0000 (16:46 +0100)]
Fixes #834 - adds extra line break in nested blocks.

Why:

* It's slightly easier to read when preserving line breaks.

7 years agoFixes #839 - allows URIs in import inlining rules.
Jakub Pawlowicz [Sun, 18 Dec 2016 11:24:53 +0000 (12:24 +0100)]
Fixes #839 - allows URIs in import inlining rules.

Why:

* To give more control over which resource can and cannot be
  inlined.

7 years agoBumps nock dev dependency to 9.x.
Jakub Pawlowicz [Sun, 18 Dec 2016 10:02:05 +0000 (11:02 +0100)]
Bumps nock dev dependency to 9.x.

7 years agoBumps online version to clean-css 3.4.23.
Jakub Pawlowicz [Sat, 17 Dec 2016 17:04:17 +0000 (18:04 +0100)]
Bumps online version to clean-css 3.4.23.