clean-css.git
7 years agoVersion 4.0.9 release notes.
Jakub Pawlowicz [Tue, 14 Mar 2017 16:53:35 +0000 (17:53 +0100)]
Version 4.0.9 release notes.

7 years agoFixes #903 - web UI and source maps.
Jakub Pawlowicz [Tue, 14 Mar 2017 15:03:33 +0000 (16:03 +0100)]
Fixes #903 - web UI and source maps.

Fixes processing source maps in web UI, while disabling applying
source maps and loading remote sources whenever source maps are
disabled.

Ideally we should build source maps in web UI but only if an inlined
source map is provided - see #915.

7 years agoFixes #902 - case insensitive attribute matchers.
Jakub Pawlowicz [Tue, 14 Mar 2017 09:35:54 +0000 (10:35 +0100)]
Fixes #902 - case insensitive attribute matchers.

Why:

* CSS 4 spec defines case insensitive matchers which were treated
  incorrectly by attribute tidying code.

7 years agoFixes #907 - compatibility of space after closing brace.
Jakub Pawlowicz [Tue, 14 Mar 2017 09:19:35 +0000 (10:19 +0100)]
Fixes #907 - compatibility of space after closing brace.

Why:

* Apparently `@supports` doesn't like stripping that extra space
  after `)` character.

7 years agoFixes #910 - too aggressive precision optimizations.
Jakub Pawlowicz [Mon, 13 Mar 2017 21:22:22 +0000 (22:22 +0100)]
Fixes #910 - too aggressive precision optimizations.

Why:

* Precision rounding should only apply when a value is positively
identified as a numeric or unit value.

7 years agoexplicitly mention the CLI utility (#912)
Mike Kamermans [Sun, 12 Mar 2017 07:34:17 +0000 (23:34 -0800)]
explicitly mention the CLI utility (#912)

7 years agoUpdate README.md (#909)
Moritz Kröger [Sat, 11 Mar 2017 14:04:42 +0000 (15:04 +0100)]
Update README.md (#909)

Fixes wrong variable name in usage demo

7 years agoBumps web interface to version 4.0.8.
Jakub Pawlowicz [Wed, 22 Feb 2017 16:26:39 +0000 (17:26 +0100)]
Bumps web interface to version 4.0.8.

7 years agoVersion 4.0.8 release notes.
Jakub Pawlowicz [Wed, 22 Feb 2017 16:20:16 +0000 (17:20 +0100)]
Version 4.0.8 release notes.

7 years agoFixes #899 - regression in optimizing pseudo class arguments.
Jakub Pawlowicz [Wed, 22 Feb 2017 16:13:12 +0000 (17:13 +0100)]
Fixes #899 - regression in optimizing pseudo class arguments.

Why:

* `+` character is both a 1) relation or 2) operator within
  pseudo class arguments; so these two use cases should be
  distinct.

7 years agoFixes edge case in remote stylesheet fetching.
Jakub Pawlowicz [Fri, 17 Feb 2017 06:47:44 +0000 (07:47 +0100)]
Fixes edge case in remote stylesheet fetching.

Why:

* When a request results in an error or timeout then any further
  fetching should be aborted as callback has already been called.

7 years agoVersion 3.4.25 release notes.
Jakub Pawlowicz [Wed, 22 Feb 2017 15:42:10 +0000 (16:42 +0100)]
Version 3.4.25 release notes.

7 years agoFixes #886 - better multi pseudo class / element merging.
Jakub Pawlowicz [Thu, 16 Feb 2017 15:44:02 +0000 (16:44 +0100)]
Fixes #886 - better multi pseudo class / element merging.

Why:

* 4.0 introduced a stricter mergeability rules, however in some
  cases merging is still possible but harder to determine;
* tests suggested all multi pseudo class / element rules can be
  merged unless those contain more than one of the following:
  `:after`, `::after`, `:before`, `::before`, `:first-letter`,
  `::first-letter`, `:first-line`, `::first-line`, or `:lang`;
* there's also a new compatibility switch,
  `{ compatibility: { selectors: { multiplePseudoMerging: false } } }`
  which, if set to false, disables merging for all rules with
  multiple pseudo classes / elements.

7 years agoFixes #890 - adds toggle to disable empty tokens removal.
Jakub Pawlowicz [Wed, 15 Feb 2017 18:48:33 +0000 (19:48 +0100)]
Fixes #890 - adds toggle to disable empty tokens removal.

Why:

* Removing empty tokens (rules & blocks) was the only "optimization"
  which was not toggabble;
* introduces a side-effect in level 2 optimizations where rules that
  become empty as a result of complex optimizations are preserved.

7 years agoAdds readme section about upcoming changes.
Jakub Pawlowicz [Wed, 15 Feb 2017 19:01:05 +0000 (20:01 +0100)]
Adds readme section about upcoming changes.

Covers changes introduced in #893.

7 years agoFixes #893 - `inline: false` as alias to `inline: 'none'`.
Jakub Pawlowicz [Tue, 14 Feb 2017 12:53:33 +0000 (13:53 +0100)]
Fixes #893 - `inline: false` as alias to `inline: 'none'`.

Why:

* So it matches other options where `false` means 'disable'.

7 years agoBumps version on master to 4.1.0-pre.
Jakub Pawlowicz [Tue, 14 Feb 2017 12:52:45 +0000 (13:52 +0100)]
Bumps version on master to 4.1.0-pre.

7 years agoBumps web interface to version 4.0.7.
Jakub Pawlowicz [Tue, 14 Feb 2017 11:39:56 +0000 (12:39 +0100)]
Bumps web interface to version 4.0.7.

7 years agoVersion 4.0.7 release notes.
Jakub Pawlowicz [Tue, 14 Feb 2017 08:12:12 +0000 (09:12 +0100)]
Version 4.0.7 release notes.

7 years agoFixes #891 - merging vendor-prefixed pseudo classes.
Jakub Pawlowicz [Tue, 14 Feb 2017 07:29:34 +0000 (08:29 +0100)]
Fixes #891 - merging vendor-prefixed pseudo classes.

Why:

* When a pseudo-class or pseudo-element was positioned after
  quoted string it was not extracted for mergeability comparison.

7 years agoSee #892 - adds better `inline` option docs.
Jakub Pawlowicz [Tue, 14 Feb 2017 07:05:38 +0000 (08:05 +0100)]
See #892 - adds better `inline` option docs.

7 years agoBumps web interface to version 4.0.6.
Jakub Pawlowicz [Fri, 10 Feb 2017 10:33:27 +0000 (11:33 +0100)]
Bumps web interface to version 4.0.6.

7 years agoVersion 4.0.6 release notes.
Jakub Pawlowicz [Fri, 10 Feb 2017 10:24:58 +0000 (11:24 +0100)]
Version 4.0.6 release notes.

7 years agoFixes #885 - don't strip quotes from `font-feature-settings`.
Jakub Pawlowicz [Wed, 8 Feb 2017 07:35:01 +0000 (08:35 +0100)]
Fixes #885 - don't strip quotes from `font-feature-settings`.

Why:

* Browsers don't get it right when without quotes;
* it'll all be better with whitelist based optimizations, see #889.

7 years agoBumps web interface to version 4.0.5.
Jakub Pawlowicz [Tue, 7 Feb 2017 10:41:30 +0000 (11:41 +0100)]
Bumps web interface to version 4.0.5.

7 years agoVersion 4.0.5 release notes.
Jakub Pawlowicz [Tue, 7 Feb 2017 10:05:35 +0000 (11:05 +0100)]
Version 4.0.5 release notes.

7 years agoFixes #884 - handling absolute paths on Windows.
Jakub Pawlowicz [Mon, 6 Feb 2017 13:42:46 +0000 (14:42 +0100)]
Fixes #884 - handling absolute paths on Windows.

Why:

* There's a built-in `path.isAbsolute` which should have been used
  in the first place;
* `inlineLocalStylesheets` absolute path handling with be gone in
  the next major version when virtual absolute paths will be gone.

7 years agoFixes #880 - incorrect token type identification.
Jakub Pawlowicz [Mon, 6 Feb 2017 06:17:45 +0000 (07:17 +0100)]
Fixes #880 - incorrect token type identification.

Why:

* When there is no space after nested block scope, e.g.
  `@media(` in `@media(min-width:100px)` it should still be
  handled correctly by tokenizer.

7 years agoAdds #881 changelog entry.
Jakub Pawlowicz [Mon, 6 Feb 2017 06:08:11 +0000 (07:08 +0100)]
Adds #881 changelog entry.

7 years agoFix wrong require arity (#881)
Olivier Tassinari [Mon, 6 Feb 2017 05:44:51 +0000 (06:44 +0100)]
Fix wrong require arity (#881)

7 years agoBumps web interface to version 4.0.4.
Jakub Pawlowicz [Sat, 4 Feb 2017 06:45:21 +0000 (07:45 +0100)]
Bumps web interface to version 4.0.4.

7 years agoVersion 4.0.4 release notes.
Jakub Pawlowicz [Sat, 4 Feb 2017 06:36:06 +0000 (07:36 +0100)]
Version 4.0.4 release notes.

7 years agoFixes #879 - incorrect handling of spaces in paths.
Jakub Pawlowicz [Sat, 4 Feb 2017 06:17:00 +0000 (07:17 +0100)]
Fixes #879 - incorrect handling of spaces in paths.

Why:

* When reading sources passed in as array, paths need to be wrapped
  in `url()` so spaces are handled correctly.

7 years agoFixes #878 - invalid double backshlash tokenization.
Jakub Pawlowicz [Sat, 4 Feb 2017 05:52:51 +0000 (06:52 +0100)]
Fixes #878 - invalid double backshlash tokenization.

Why:

* Any subsequent backslash escape character was treated as
  another escape sequence.

7 years agofix typo (#877)
yumetodo [Thu, 2 Feb 2017 10:18:36 +0000 (19:18 +0900)]
fix typo (#877)

s/ontrols/controls/

7 years agoFixes a typo in History.md.
Jakub Pawlowicz [Wed, 1 Feb 2017 15:43:58 +0000 (16:43 +0100)]
Fixes a typo in History.md.

Thx to @ngyikp for reporting.

7 years agoBumps web interface to version 4.0.3.
Jakub Pawlowicz [Mon, 30 Jan 2017 06:40:54 +0000 (07:40 +0100)]
Bumps web interface to version 4.0.3.

7 years agoVersion 4.0.3 release notes.
Jakub Pawlowicz [Mon, 30 Jan 2017 06:34:03 +0000 (07:34 +0100)]
Version 4.0.3 release notes.

7 years agoSee #875 - adds missing History.md entry.
Jakub Pawlowicz [Mon, 30 Jan 2017 06:33:18 +0000 (07:33 +0100)]
See #875 - adds missing History.md entry.

7 years agoFixes #875 - :facepalm: bug in semantic merging.
Jakub Pawlowicz [Fri, 27 Jan 2017 07:27:47 +0000 (08:27 +0100)]
Fixes #875 - :facepalm: bug in semantic merging.

Why:

* This is still an under tested feature but we'll get there.

7 years agoBumps web interface to version 4.0.2.
Jakub Pawlowicz [Thu, 26 Jan 2017 13:52:16 +0000 (14:52 +0100)]
Bumps web interface to version 4.0.2.

7 years agoVersion 4.0.2 release notes.
Jakub Pawlowicz [Thu, 26 Jan 2017 13:42:58 +0000 (14:42 +0100)]
Version 4.0.2 release notes.

7 years agoFixes #874 - regression in at-rule tokenization.
Jakub Pawlowicz [Thu, 26 Jan 2017 13:35:42 +0000 (14:35 +0100)]
Fixes #874 - regression in at-rule tokenization.

Why:

* Another case after #872 where at-rules were incorrectly
  tokenized because `propertyToken` wasn't reset.

7 years agoBumps web interface to version 4.0.1.
Jakub Pawlowicz [Wed, 25 Jan 2017 10:33:11 +0000 (11:33 +0100)]
Bumps web interface to version 4.0.1.

7 years agoVersion 4.0.1 release notes.
Jakub Pawlowicz [Wed, 25 Jan 2017 10:24:24 +0000 (11:24 +0100)]
Version 4.0.1 release notes.

7 years agoSee #872 - two additional cases.
Jakub Pawlowicz [Wed, 25 Jan 2017 10:13:23 +0000 (11:13 +0100)]
See #872 - two additional cases.

Unrelated to the ticket but should still be handled correctly.

7 years agoFixes #872 - edge case in tokenization.
Jakub Pawlowicz [Wed, 25 Jan 2017 10:12:14 +0000 (11:12 +0100)]
Fixes #872 - edge case in tokenization.

Why:

* On closing curly brace `}` both `ruleToken` and `propertyToken`
  should be nullified to prevent incorrect property assignments.

7 years agoFixes #868 - accept absolute paths in input hash.
Jakub Pawlowicz [Tue, 24 Jan 2017 20:18:03 +0000 (21:18 +0100)]
Fixes #868 - accept absolute paths in input hash.

Thanks to @madwizard-thomas for bug investigation which turned
out to be correct.

Why:

* Internally all local URIs should be represented as relative
  paths normalized to *nix format so nothing else gets propagated
  to output styles or source maps;
* all remote URIs are kept as is.

7 years agoFixes #867 - skips optimizing variable values.
Jakub Pawlowicz [Tue, 24 Jan 2017 14:43:33 +0000 (15:43 +0100)]
Fixes #867 - skips optimizing variable values.

Why:

* It may not be the best idea as we don't know what a value
  represents and where it'll end up.

7 years agoFixes #866 - edge case in `inline` flag handling.
Jakub Pawlowicz [Tue, 24 Jan 2017 12:16:00 +0000 (13:16 +0100)]
Fixes #866 - edge case in `inline` flag handling.

Why:

* When reverse order of options was used, so `remote,local`,
  a resource was incorrectly marked as not allowed;
* apparently we should always default remote URLs to disallowed,
  while local ones should be allowed by default.

7 years agochore(package): update browserify to version 14.0.0 (#871)
greenkeeper[bot] [Wed, 25 Jan 2017 09:19:23 +0000 (10:19 +0100)]
chore(package): update browserify to version 14.0.0 (#871)

https://greenkeeper.io/

7 years agoRe-enables batch tests on Windows. (#869)
Alex Lam S.L [Tue, 24 Jan 2017 09:30:00 +0000 (17:30 +0800)]
Re-enables batch tests on Windows. (#869)

Fix up assertEqualLineByLine(), checks if number of lines are equal before verifying content.

7 years agoSee #858 - updates web interface for clean-css 4.
Jakub Pawlowicz [Mon, 23 Jan 2017 10:00:36 +0000 (11:00 +0100)]
See #858 - updates web interface for clean-css 4.

Why:

* 4.0 changes lots of options and web users should still be able to
  apply all of them.

7 years agoVersion 4.0.0.
Jakub Pawlowicz [Mon, 23 Jan 2017 15:24:57 +0000 (16:24 +0100)]
Version 4.0.0.

7 years agoUpdates acknowledgements section.
Jakub Pawlowicz [Mon, 23 Jan 2017 15:15:05 +0000 (16:15 +0100)]
Updates acknowledgements section.

Thanks @alexlamsl, @ben-eb, @madwizard-thomas, and @ngyikp.

7 years agoSee #864 - adds better docs for optimization levels.
Jakub Pawlowicz [Mon, 23 Jan 2017 14:53:21 +0000 (15:53 +0100)]
See #864 - adds better docs for optimization levels.

It's not obvious if level 2 is used that level 1 is on by
default, and that both configurations can be applied
at the same time.

7 years agoRe-enables protocol tests on Windows.
Jakub Pawlowicz [Mon, 23 Jan 2017 13:06:00 +0000 (14:06 +0100)]
Re-enables protocol tests on Windows.

Thanks to @alexlamsl for bringing it up and testing.

Why:

* Disabled as they errored on Windows in the past, but they seem to
  work fine now.

7 years agoReworks Readme to be more readable.
Jakub Pawlowicz [Mon, 23 Jan 2017 13:04:33 +0000 (14:04 +0100)]
Reworks Readme to be more readable.

Why:

* Provides Table of contents at the top with quick links to
  interesting sections;
* Provides detailed description of available options with examples;
* Provides a FAQ section with various usage scenarios.

7 years agoSee #846 - moves CLI to a separate repository.
Jakub Pawlowicz [Sun, 22 Jan 2017 10:31:09 +0000 (11:31 +0100)]
See #846 - moves CLI to a separate repository.

Moved to https://github.com/jakubpawlowicz/clean-css-cli

Why:

* At least 85% of top dependants use the API (see ticket) so
  removing CLI removes `commander` dependency for them;
* docs will be easier to follow as they describe API only;
* tests run 10x as fast since binary tests took 90% of time;
* CLI will be able to provide its own set of features which
  are not necessarilly provided or requred in API.

Drawbacks:

* It won't be straightforward to quickly test arbitrary CSS
  as binary is not available out of the box.

7 years agoCleans up serializer code.
Jakub Pawlowicz [Fri, 20 Jan 2017 11:30:24 +0000 (12:30 +0100)]
Cleans up serializer code.

Why:

* Makes serialization context always the first argument;
* renamed function names for better clarity.

7 years agoRenames 'star' to 'asterisk'.
Jakub Pawlowicz [Fri, 20 Jan 2017 10:20:20 +0000 (11:20 +0100)]
Renames 'star' to 'asterisk'.

Why:

* This is the character's name.

7 years agoRenames curly bracket constants.
Jakub Pawlowicz [Fri, 20 Jan 2017 10:12:19 +0000 (11:12 +0100)]
Renames curly bracket constants.

Why:

* To match other bracket constants.

7 years agoRenames `Token.BLOCK` to `Token.NESTED_BLOCK`.
Jakub Pawlowicz [Fri, 20 Jan 2017 10:08:03 +0000 (11:08 +0100)]
Renames `Token.BLOCK` to `Token.NESTED_BLOCK`.

Why:

* All CSS blocks can be nested so this name reflects
  this rule better.

7 years agoSimplifies `split` helper code.
Jakub Pawlowicz [Fri, 20 Jan 2017 09:53:20 +0000 (10:53 +0100)]
Simplifies `split` helper code.

Why:

* Much of its complexity was due to old tokenizer which is no more;
* currently it serves as a way to splitting strings where commas
  inside round brackets are ignored.

7 years agoBumps copyright timestamps to 2017.
Jakub Pawlowicz [Fri, 20 Jan 2017 09:45:11 +0000 (10:45 +0100)]
Bumps copyright timestamps to 2017.

7 years agoFixes linting warning in specificity module.
Jakub Pawlowicz [Fri, 20 Jan 2017 09:44:29 +0000 (10:44 +0100)]
Fixes linting warning in specificity module.

7 years agoMoves API options setup to `options` folder-space.
Jakub Pawlowicz [Fri, 20 Jan 2017 09:42:05 +0000 (10:42 +0100)]
Moves API options setup to `options` folder-space.

Why:

* So it lives alongside optimization level and formatting setup.

7 years agoBumps online version to clean-css 3.4.24.
Jakub Pawlowicz [Fri, 20 Jan 2017 08:09:58 +0000 (09:09 +0100)]
Bumps online version to clean-css 3.4.24.

7 years agoVersion 3.4.24 release notes.
Jakub Pawlowicz [Fri, 20 Jan 2017 07:40:59 +0000 (08:40 +0100)]
Version 3.4.24 release notes.

7 years agoFixes #859 - avoids `-webkit-border-radius` optimizations.
Jakub Pawlowicz [Mon, 16 Jan 2017 16:55:38 +0000 (17:55 +0100)]
Fixes #859 - avoids `-webkit-border-radius` optimizations.

Why:

* Apparently it doesn't support shortening 4 values to 2, as the
  latter is taken as a horizontal + vertical radius in all corners;
* disabling any optimizations as a precaution;
* see http://jsfiddle.net/qnGKj/2881/

7 years agoSee #856 - adds missing History.md entry.
Jakub Pawlowicz [Fri, 20 Jan 2017 07:31:00 +0000 (08:31 +0100)]
See #856 - adds missing History.md entry.

7 years agoFixes #863 - adds `transform` callback for custom optimizations.
Jakub Pawlowicz [Thu, 19 Jan 2017 19:50:59 +0000 (20:50 +0100)]
Fixes #863 - adds `transform` callback for custom optimizations.

Why:

* So users can apply custom optimizations without forking clean-css
  and learning how to plug such optimization in;
* may also aid in rewriting URLs after introduction of `rebaseTo`.

7 years agoFixes #856 - allows `minify` to return a promise.
Jakub Pawlowicz [Thu, 19 Jan 2017 14:01:32 +0000 (15:01 +0100)]
Fixes #856 - allows `minify` to return a promise.

Why:

* Useful as an alternative to callback API;
* future Node.js versions will support `await` mechanism
  which requires supporting promises.

7 years agoAdds `overrideProperties` level 2 optimizations flag.
Jakub Pawlowicz [Wed, 18 Jan 2017 17:02:16 +0000 (18:02 +0100)]
Adds `overrideProperties` level 2 optimizations flag.

Why:

* Previously property overriding was controlled via `mergeIntoShorthands`
  flag which was confusing.

7 years agoMoves 'compacting' code to 'properties' folder-space.
Jakub Pawlowicz [Wed, 18 Jan 2017 16:46:03 +0000 (17:46 +0100)]
Moves 'compacting' code to 'properties' folder-space.

Why:

* All those optimizations are dealing with properties so the new
  name better reflects its role;

Also:

* renames `overrideCompactor` to `overrideProperties`;
* renames `compactorOptimize` to `optimizeProperties`.
* cleans up property optimizing code calling from level 2 optimizations
  due to removal of aggressive merging, see #290.

7 years agoRenames `compactShorthands` level 2 option to `mergeIntoShorthands`.
Jakub Pawlowicz [Wed, 18 Jan 2017 15:46:04 +0000 (16:46 +0100)]
Renames `compactShorthands` level 2 option to `mergeIntoShorthands`.

Why:

* It better describes what this option does.

7 years agoMakes compactable code more explicit.
Jakub Pawlowicz [Wed, 18 Jan 2017 15:17:09 +0000 (16:17 +0100)]
Makes compactable code more explicit.

Why:

* All unprefixed properties has to be declared explicitely,
  while vendor prefixed ones can be generated from them.

7 years agoSee #290 - adds removing IE filters.
Jakub Pawlowicz [Wed, 18 Jan 2017 13:56:34 +0000 (14:56 +0100)]
See #290 - adds removing IE filters.

Why:

* Internet Explorer `filter` / `-ms-filter` are unsupported since
  IE 10, which is also clean-css new default compatibility;
* can be restored by using `ie7`, `ie8`, or `ie9` compatibility
  modes.

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.