Jakub Pawlowicz [Sun, 15 Mar 2015 14:05:30 +0000 (14:05 +0000)]
Makes `root` option implicitely default to `process.cwd()` unless given.
Jakub Pawlowicz [Thu, 12 Mar 2015 19:15:03 +0000 (19:15 +0000)]
Version 3.1.6 release notes.
Jakub Pawlowicz [Thu, 12 Mar 2015 19:10:40 +0000 (19:10 +0000)]
Fixes #489 - edge case in filter optimizations.
So Chroma and Alpha filters can be shortened if they are not mixed,
but the regexp was too greedy and AlphaImageLoader was matched too.
Jakub Pawlowicz [Sat, 7 Mar 2015 17:36:36 +0000 (17:36 +0000)]
Updates nock dependency to version 1.x.
Jakub Pawlowicz [Sat, 7 Mar 2015 11:33:27 +0000 (11:33 +0000)]
Merge pull request #486 from XhmikosR/patch-2
Update appveyor.yml
Jakub Pawlowicz [Sat, 7 Mar 2015 11:33:18 +0000 (11:33 +0000)]
Merge pull request #485 from XhmikosR/patch-1
Update History.md
XhmikosR [Sat, 7 Mar 2015 11:10:10 +0000 (13:10 +0200)]
Update appveyor.yml
Use `1` for io.js.
XhmikosR [Sat, 7 Mar 2015 11:09:33 +0000 (13:09 +0200)]
Update History.md
[ci skip]
Jakub Pawlowicz [Fri, 6 Mar 2015 21:18:25 +0000 (21:18 +0000)]
Version 3.1.5 release notes.
Jakub Pawlowicz [Fri, 6 Mar 2015 21:16:07 +0000 (21:16 +0000)]
Fixes #483 - property order in restructuring.
This:
```css
a{background-size:100%}
p{background:no-repeat;background-size:100%}
```
cannot be restructured into:
```css
a,p{background-size:100%}
p{background:no-repeat}
```
Jakub Pawlowicz [Thu, 5 Mar 2015 19:38:38 +0000 (19:38 +0000)]
Fixes #376 - compat option to disable 0[unit] -> 0 minifying.
It turns out unit removal messes up with transforms in IE10-12.
Jakub Pawlowicz [Thu, 5 Mar 2015 06:54:40 +0000 (06:54 +0000)]
Fixes #480 - uppercase properties in reordering.
It's an edge case but we should support it nonetheless.
Jakub Pawlowicz [Wed, 4 Mar 2015 08:30:49 +0000 (08:30 +0000)]
Version 3.1.4 release notes.
Jakub Pawlowicz [Wed, 4 Mar 2015 10:10:17 +0000 (10:10 +0000)]
Fixes #472 - broken function minification.
There was a wrong tokenization inside functions (gradient) with
functions (rgb) inside them.
Eduardo Abela [Tue, 3 Mar 2015 15:52:09 +0000 (16:52 +0100)]
Fixes #476 - keep `@import`s on top when restructuring.
It is the same story as with `@charset`s and important comments.
Jakub Pawlowicz [Tue, 3 Mar 2015 22:31:12 +0000 (22:31 +0000)]
Fixes #478 - whitespace after closing brace.
So instead of aiding tokenization on top level we should only alter
body tags with a brace.
It was naive to do it on the top level in the first place :/
Jakub Pawlowicz [Tue, 3 Mar 2015 14:38:32 +0000 (14:38 +0000)]
Points version in master to 3.2.0-pre.
Jakub Pawlowicz [Tue, 3 Mar 2015 13:48:18 +0000 (13:48 +0000)]
Version 3.1.3 release notes.
Jakub Pawlowicz [Mon, 2 Mar 2015 23:38:13 +0000 (23:38 +0000)]
Fixes #464 - handling escaped braces in URLs.
It was properly handled in URL processor but not URL rewriter.
This fix extracts a UrlScanner class with algorithm from URL processor
and reuses it in URL rewriter.
Technically it should be a fix not such a "major" refactor, but bending
the rules shouldn't hurt :-).
Jakub Pawlowicz [Mon, 2 Mar 2015 22:24:17 +0000 (22:24 +0000)]
Fixes #475 - correctly handle whitespace after closing bracket.
There was an issue with `:not(...).class` turned into `:not(...) .class`.
Jakub Pawlowicz [Mon, 2 Mar 2015 07:51:23 +0000 (07:51 +0000)]
Merge pull request #474 from XhmikosR/master
bin/cleancss: use `console.log` instead of `util.puts`.
XhmikosR [Sun, 1 Mar 2015 20:09:31 +0000 (22:09 +0200)]
bin/cleancss: use `console.log` instead of `util.puts`.
Fixes warning with node.js 0.12.
Jakub Pawlowicz [Sun, 1 Mar 2015 18:00:42 +0000 (18:00 +0000)]
Version 3.1.2.
Jakub Pawlowicz [Sun, 1 Mar 2015 17:56:57 +0000 (17:56 +0000)]
Fixes #466 - rebuilding background shorthand.
In case of multi-value shorthands (comma separated) we reuse tokens
instead of cloning when splitting / rebuilding values.
There was an edge case in rebuilding when having more than one
`background` in a rule.
Jakub Pawlowicz [Sun, 1 Mar 2015 16:49:01 +0000 (16:49 +0000)]
Fixes #462 - escaped apostrophes in selector rules.
QuoteScanner were not scanning correctly for escaped apostrophes.
Jakub Pawlowicz [Sun, 1 Mar 2015 09:36:19 +0000 (09:36 +0000)]
Refixes #471 - correct order after restructuring.
Apparently multiple important comments were not factored in.
Jakub Pawlowicz [Sun, 1 Mar 2015 13:22:49 +0000 (13:22 +0000)]
Fixes #396 - better input source maps tracking.
We do it in tokenization step now instead of stringifying. That aids
compatibility as we get raw not processed content.
Jakub Pawlowicz [Sun, 1 Mar 2015 10:46:05 +0000 (10:46 +0000)]
Refactores source map tracking.
On unknown source a `$stdin` value is now used instead of `__stdin__.css`.
Jakub Pawlowicz [Sun, 1 Mar 2015 14:12:09 +0000 (14:12 +0000)]
Merge pull request #473 from XhmikosR/master
Remove extra commas.
XhmikosR [Sun, 1 Mar 2015 13:25:54 +0000 (15:25 +0200)]
Change prepublish script to use the check one instead of duplicating it.
XhmikosR [Sun, 1 Mar 2015 13:22:40 +0000 (15:22 +0200)]
Remove extra commas.
Jakub Pawlowicz [Fri, 27 Feb 2015 19:52:51 +0000 (19:52 +0000)]
Fixes 3.1.0 changelog diff link.
Jakub Pawlowicz [Fri, 27 Feb 2015 19:52:30 +0000 (19:52 +0000)]
Version 3.1.1.
Jakub Pawlowicz [Fri, 27 Feb 2015 19:48:27 +0000 (19:48 +0000)]
Fixes #469 - extracting from broken property.
That should never happen but skip such properties if ever encountered.
Jakub Pawlowicz [Fri, 27 Feb 2015 19:29:08 +0000 (19:29 +0000)]
Fixes #471 - preserves correct order after restructuring.
Restructured content should not end up before important comments or
a charset.
Jakub Pawlowicz [Fri, 27 Feb 2015 09:43:39 +0000 (09:43 +0000)]
Fixes #470 - negative padding.
Basically negative paddings are not allowed by browsers so we should
not merge them into shorthands.
Jakub Pawlowicz [Thu, 26 Feb 2015 08:40:08 +0000 (08:40 +0000)]
Version 3.1.0.
Jakub Pawlowicz [Wed, 25 Feb 2015 22:47:52 +0000 (22:47 +0000)]
Bumps browserify to 9.x.
Jakub Pawlowicz [Wed, 25 Feb 2015 22:35:39 +0000 (22:35 +0000)]
Updates changelog with io.js info.
Jakub Pawlowicz [Wed, 25 Feb 2015 22:24:39 +0000 (22:24 +0000)]
Adds restructuring info to 3.1 changelog.
Jakub Pawlowicz [Wed, 25 Feb 2015 22:19:29 +0000 (22:19 +0000)]
Adds `--skip-restructuring` / `restructuring` switches.
Adds a CLI & API switches to turn off restructuring, which is on
by default.
Jakub Pawlowicz [Wed, 25 Feb 2015 20:39:01 +0000 (20:39 +0000)]
Improves property reordering.
* Extracts extracting and 'canReorder' into modules.
* Adds better property extracting so more properties can be reordered correctly.
* Fixes joined data ordering.
Jakub Pawlowicz [Wed, 25 Feb 2015 20:35:31 +0000 (20:35 +0000)]
Reworks same-selector merging to run both ways.
This way it can optimize more use cases as content may not be
movable one way but it could be other way, e.g.:
```css
a{color:red}
p{display:block}
a{display:inline-block}
```
In this case the third selector can't be moved and merged with the
first one, but it can be done the other way around.
Jakub Pawlowicz [Sun, 22 Feb 2015 21:54:36 +0000 (21:54 +0000)]
Improves reordering by trying multiple fits.
Tries to find the best possible option of token re-arrangements, which
at the same time solves issue with reordering more than one selector at
a time.
Instead of comparing pre- and post-reordering size it tries subsets
of selectors too (one level deep) for possible better options.
Jakub Pawlowicz [Sun, 22 Feb 2015 14:33:29 +0000 (14:33 +0000)]
Adds smarter reordering rules.
We can reorder two properties if one them is shorthand and the other
is granular but they have the same value.
Note: it may be improved even further with #429 in place. At that time
we may compare exact values, e.g. `margin:0 1px` is currently not
swappable with `margin-top:0` but it should.
Jakub Pawlowicz [Sun, 22 Feb 2015 12:52:34 +0000 (12:52 +0000)]
Improves restructuring optimizations.
We were not using restructuring optimizer fully, because every property that
was previously encountered, was not reused again, see `optimizer-test.js`
for a use case.
Jakub Pawlowicz [Sun, 22 Feb 2015 11:36:38 +0000 (11:36 +0000)]
Speeds up restructuring.
We don't need to do a full selector cleanup, just remove repetitions
and remap.
Jakub Pawlowicz [Sun, 22 Feb 2015 10:53:37 +0000 (10:53 +0000)]
Speeds up advanced optimizations.
There's no need to rerun duplicate removal and merging adjacent
optimizers since we have smart reordering in place.
Jakub Pawlowicz [Sun, 22 Feb 2015 09:19:15 +0000 (09:19 +0000)]
Disables restructuring inside @keyframes.
It's forbidden by the spec, see "Duplicate resolution" on
https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes
Jakub Pawlowicz [Mon, 5 Jan 2015 23:20:27 +0000 (23:20 +0000)]
Adds smart selector restructuring.
The algorithm traverses tokens list backwards, picking up any properties
on its way. If a property already exists and has the same value, it adds
the current token to the list of matching that property, otherwise one
of two things happens:
* The property is dropped from the list if there's been only one token
associated with it.
* It tries to move properties around if it results in a shorter content.
Jakub Pawlowicz [Fri, 20 Feb 2015 21:04:37 +0000 (21:04 +0000)]
Uses root directory for temp data.
Jakub Pawlowicz [Fri, 20 Feb 2015 20:50:41 +0000 (20:50 +0000)]
Fixes networking tests.
Adds 'server-destroy' which helps with closing server sockets.
Also ensures that inliner reports one error only for a resource.
Jakub Pawlowicz [Tue, 17 Feb 2015 19:50:24 +0000 (19:50 +0000)]
Updates History.md with #463 info.
Siguršur Gušbrandsson [Mon, 16 Feb 2015 21:35:19 +0000 (21:35 +0000)]
Fixes #463 - relative remote @import URLs.
Testcase:
cleancss -d --root http://jeffwalker.com/wp-content/themes/salient-child/ http://jeffwalker.com/wp-content/themes/salient-child/style.css?ver=4.1.1
Jakub Pawlowicz [Mon, 16 Feb 2015 09:13:26 +0000 (09:13 +0000)]
Merge pull request #461 from XhmikosR/ci
Update CI configs
XhmikosR [Mon, 16 Feb 2015 07:10:31 +0000 (09:10 +0200)]
AppVeyor: clear cache when package.json changes.
XhmikosR [Mon, 16 Feb 2015 07:10:18 +0000 (09:10 +0200)]
Travis CI: Add io.js and fast finish.
Jakub Pawlowicz [Sun, 15 Feb 2015 21:26:31 +0000 (21:26 +0000)]
Tweaks source maps tests to allow Windows tests to pass.
Jakub Pawlowicz [Sun, 15 Feb 2015 21:04:42 +0000 (21:04 +0000)]
Merge pull request #458 from XhmikosR/appveyor
Add AppVeyor for Windows tests.
XhmikosR [Sat, 7 Feb 2015 13:04:47 +0000 (15:04 +0200)]
Add AppVeyor for Windows tests.
Jakub Pawlowicz [Wed, 11 Feb 2015 09:15:17 +0000 (09:15 +0000)]
Clean up in History.md.
* Old repo name sneaked in.
* Pre-release diff should point to `HEAD` instead of a missing tag.
Jakub Pawlowicz [Wed, 11 Feb 2015 09:13:16 +0000 (09:13 +0000)]
Updates changelog with node.js 0.12 info.
Jakub Pawlowicz [Tue, 10 Feb 2015 20:47:48 +0000 (20:47 +0000)]
Enables 'by selector' advanced merging over media.
It works already for merging media blocks, so it's just a matter
of enabling it for 'by selector' merging.
Jakub Pawlowicz [Tue, 10 Feb 2015 07:55:19 +0000 (07:55 +0000)]
Adds a way to switch off `@media` merging.
* In API mode, set `mediaMerging` option to false.
* In CLI mode, add `--skip-media-merging` switch.
Jakub Pawlowicz [Tue, 10 Feb 2015 07:31:00 +0000 (07:31 +0000)]
Improves selector traversal in advanced merging.
Selectors can be reordered if one of the following rules regarding
any pair of its properties is met:
* Property name root (`font` in `font-size`) is different, e.g.
`margin:0` <-> `color:red`
* Property name root, name, and value are the same, e.g.
`color:red` <-> `color:red`
`margin-top:0` <-> `margin-top:0`
* Property name root is the same, names are different, and any name
is not root, e.g
`margin-top:0` <-> `margin-bottom:10px`
Jakub Pawlowicz [Sun, 8 Feb 2015 11:42:42 +0000 (11:42 +0000)]
Simplifies selector traversal in advanced merging.
Unifies selector traversal from `@media` merge algorithm and one
merging selectors with same name.
Effectively solves `@media` merging issue when traversed property
can be a shorthand.
Jakub Pawlowicz [Sun, 8 Feb 2015 11:00:40 +0000 (11:00 +0000)]
Fixes an edge case in merging non-adjacent selectors by name.
Jakub Pawlowicz [Sat, 7 Feb 2015 19:45:37 +0000 (19:45 +0000)]
Fixes #204 - media query merging.
It adds media query merging with the following set of rules:
* adjacent media with same conditions can be merged;
* non-adjacent media with same conditions can be merged only if
any of moved properties is not redefined in-between, or a
property is redefined with the exactly same value.
Jakub Pawlowicz [Tue, 10 Feb 2015 15:51:08 +0000 (15:51 +0000)]
Fixes tokenization regression issue.
Introduced in
a9c75d34.
Jakub Pawlowicz [Tue, 10 Feb 2015 09:09:37 +0000 (09:09 +0000)]
Merge pull request #456 from XhmikosR/travis
Travis: test node.js 0.12 too.
XhmikosR [Sat, 7 Feb 2015 10:17:13 +0000 (12:17 +0200)]
Travis: test node.js 0.12 too.
Jakub Pawlowicz [Sat, 7 Feb 2015 12:19:08 +0000 (12:19 +0000)]
Version 3.0.10 release notes.
Jakub Pawlowicz [Sat, 7 Feb 2015 12:16:07 +0000 (12:16 +0000)]
Fixes #455 - whitespace between braces.
`( (` was handled incorrectly as the first brace got removed.
Jakub Pawlowicz [Sat, 7 Feb 2015 11:44:31 +0000 (11:44 +0000)]
Fixes #453 - x & y `background-repeat`.
Apparently we were not handling double `background-repeat` previously.
Jakub Pawlowicz [Wed, 4 Feb 2015 23:57:01 +0000 (23:57 +0000)]
Version 3.0.9.
Jakub Pawlowicz [Wed, 4 Feb 2015 23:53:20 +0000 (23:53 +0000)]
Fixes #452 - regression in non-adjacent merging.
It's a regression from 2.2 as we added a smarter merging but it
does not always correctly compare arrays (bloody JavaScript ;-).
Jakub Pawlowicz [Sun, 1 Feb 2015 11:52:54 +0000 (11:52 +0000)]
Fixes #449 - missing close brace in a selector.
Adds proper handling of missing closing brace in selectory body:
* warning is raised;
* extra content is ignored.
Jakub Pawlowicz [Sat, 31 Jan 2015 10:15:40 +0000 (10:15 +0000)]
Version 3.0.8.
Jakub Pawlowicz [Sat, 31 Jan 2015 10:11:46 +0000 (10:11 +0000)]
Fixes #447 - `background-color` in shorthands.
Apparently `background-color` with a value of `none` can't be merged
into a shorthand as `none` value will override `background-image`.
Jakub Pawlowicz [Fri, 30 Jan 2015 22:32:25 +0000 (22:32 +0000)]
Fixes #450 - color names to hex codes.
Regexp matching color names was too greedy and was matching some
other values as well.
On the downside we need to run the replacement twice.
On the upside it extracts replacement functions so we get a slight
speed boost.
Jakub Pawlowicz [Tue, 27 Jan 2015 08:16:38 +0000 (08:16 +0000)]
Fixes #419 - handling multiple input source maps.
Adds support for multiple input source maps when data is passed in
as a hash, e.g.:
```
new CleanCSS({ sourceMap: true }).minify({
'path/to/source/1': {
styles: '...styles...',
sourceMap: '...source-map...'
},
'path/to/source/2': {
styles: '...styles...',
sourceMap: '...source-map...'
}
})
```
Effectively it is the same as concatenating source maps, but should
be less error-prone.
See 'multiple source maps' in `test/source-map-test.js` for examples.
Jakub Pawlowicz [Fri, 23 Jan 2015 22:55:39 +0000 (22:55 +0000)]
Fixes #445 - speed issue in url processor.
Obviously we don't need to search for uppercase URLs constantly, just
if there is at least one.
Jakub Pawlowicz [Fri, 23 Jan 2015 22:51:07 +0000 (22:51 +0000)]
Ensures all uppercase urls are turned into lowercase.
Ommited by mistake in
80418fac5bf7ce6bfe98f75dcb4c6c3aeb185d0d.
Jakub Pawlowicz [Thu, 22 Jan 2015 20:10:00 +0000 (20:10 +0000)]
Fixes #442 - space before adjacent `nav`.
As it turns out Android stock browser <= 4.3 needs a space
between `+` and `nav`, e.g. `div+ nav{}`.
It's off by default and can be turned on with:
* `--compatibility +selectors.adjacentSpace` or
* `compatibility: { selectors: { adjacentSpace: true } }`
See http://codepen.io/anon/pen/QwgLVv
Jakub Pawlowicz [Thu, 22 Jan 2015 19:49:13 +0000 (19:49 +0000)]
Fixes #439 - `background-origin` into shorthand.
Adds last missing bit in processing `background` shorthands with
`background-origin` and `background-clip` merging.
Follow up to #435.
See http://www.w3.org/TR/css3-background/#the-background
Jakub Pawlowicz [Thu, 22 Jan 2015 17:53:15 +0000 (17:53 +0000)]
Merge pull request #443 from XhmikosR/master
Update JSHint to v2.6.0.
Jakub Pawlowicz [Thu, 22 Jan 2015 17:53:05 +0000 (17:53 +0000)]
Merge pull request #440 from XhmikosR/patch-1
Update History.md
XhmikosR [Thu, 22 Jan 2015 16:10:44 +0000 (18:10 +0200)]
Update JSHint to v2.6.0.
Jakub Pawlowicz [Thu, 22 Jan 2015 10:54:21 +0000 (10:54 +0000)]
Version 3.0.7.
Jakub Pawlowicz [Thu, 22 Jan 2015 10:52:42 +0000 (10:52 +0000)]
Fixes #441 - hex to name color converting.
Apparently if a hex was a substring of a known hex -> name color conversion,
then it was also replaced.
Fixed by checking if hex are matched fully.
XhmikosR [Wed, 21 Jan 2015 12:43:50 +0000 (14:43 +0200)]
Update History.md
[ci skip]
Jakub Pawlowicz [Tue, 20 Jan 2015 22:09:58 +0000 (22:09 +0000)]
Fixes #435 - background-clip in background shorthand.
Adds background-clip support in collapsing into background shorthands.
It hasn't been until now so such properties were effectively dropped
from shorthands resulting in a wrong background clipping.
Jakub Pawlowicz [Tue, 20 Jan 2015 21:08:05 +0000 (21:08 +0000)]
Version 3.0.6.
Jakub Pawlowicz [Tue, 20 Jan 2015 21:00:25 +0000 (21:00 +0000)]
Refixes #414 - source map position fallback.
Apparently the original fix does not always work as selectors are
being sorted during optimizations so we cannot predict how many
fallback needs to be taken.
Fortunately doing all fallbacks for selector list is also safe, given
a source map is properly built.
It won't be needed anymore once #396 is in place.
Test case provided by @unlok in #438.
Jakub Pawlowicz [Sun, 18 Jan 2015 19:06:24 +0000 (19:06 +0000)]
Fixes #351 - remote `@import`s after content.
Changes behavior of importing remote styles after other content,
when minifying without a callback (requirement for remote `@import`s).
So far such `@import`s were kept intact and no warnings were reported.
From now on they are removed and a warning is raised, one per `@import`.
It is due to a fact that all browsers ignore `@import`s when they appear
not at the beginning of a stylesheet.
In case if a remote `@import` appears after other remote or local ones
it won't be dropped as it may be resolved at runtime (in the browser).
Jakub Pawlowicz [Sun, 18 Jan 2015 12:35:07 +0000 (12:35 +0000)]
Version 3.0.5.
Jakub Pawlowicz [Sun, 18 Jan 2015 12:24:11 +0000 (12:24 +0000)]
Fixes #433 - merging `!important` properties in shorthands.
This happens when a property is not mergeable under normal conditions,
which is 'background-size' only, as it's behind a compatibility flag, e.g.
```css
a {
background:#fff !important;
background-size:10px 10px!important;
}
```
was leading to the latter property being lost.
Jakub Pawlowicz [Thu, 15 Jan 2015 21:39:54 +0000 (21:39 +0000)]
Fixes #414 - source map position fallback.
Apparently there is a problem with building source maps from input
source maps when the latter one does not have correct (?) selector
positions.
It happens to postcss which in case of such a source:
```css
selector-1,
selector-2,
selector-3
{
color:red;
}
```
generates selector source position for the first selector only.
To fix this issue clean-css tries to find out correct selector
position going to lines above which may have a selector position.
Jakub Pawlowicz [Wed, 14 Jan 2015 20:02:13 +0000 (20:02 +0000)]
Adds missing info about passing arrays to `minify` method.
Apparently I forgot to include Readme section with #400.
Follow up to
f22851cb5a4f21ecf2189a998757724c8e910a93.
Jakub Pawlowicz [Mon, 12 Jan 2015 23:12:53 +0000 (23:12 +0000)]
Fixes #416 - accepts hash as a list of arguments.
Such a hash is now accepted as the first argument to `minify` method:
```javascript
{
'path/to/file/one': {
styles: 'contents of file one'
},
'path/to/file/two': {
styles: 'contents of file two'
}
}
```
This is also prepares us to implement #419 - merging input source maps.