Back project to life. Changed files structure, cleaned up and refactored most of sources. Closed 60+ issues.
Common
- single code base (no more
src
folder) - build browser version with
browserify
(no moremake
, andweb
folder), browser version is available atdist/csso-browser.js
- main file is
lib/index.js
now - minimal
node.js
version is0.12
now - restrict file list to publish on
npm
(no more useless folders and files in package) - add
jscs
to control code style - automate
gh-pages
update - util functions reworked
- translator reworked
- test suite reworked
- compressor refactored
- initial parser refactoring
API
- new method
minify(src, options)
, options:restructuring
– if set tofalse
, disable structure optimisations (true
by default)debug
- outputs intermediate state of CSS during compression (false
by default)
- deprecate
justDoIt()
method (useminify
instead) - rename
treeToString()
method tostringify()
- drop
printTree()
method - AST node info
column
andoffset
addedln
renamed toline
- fix line counting across multiple files and input with CR LF (#147)
CLI
- completely reworked, use clap to parse argv
- add support for input from stdin (#128)
- drop undocumented and obsoleted options
--rule
and--parser
(suppose nobody use it) - drop
-off
alias for--restructure-off
as incorrect (only one letter options should starts with single-
) - new option
--debug
that reflecting tooptions.debug
forminify
Parsing and optimizations
- keep all exclamation comments (#194)
- add
/deep/
combinator support (#209) - attribute selector
- color
- support all css/html colors
- convert
hsla
torgba
andhls
torgb
- convert
rgba
with 1 as alpha value torgb
(#122) - interpolate
rgb
andrgba
percentage values to absolute values - replace percentage values in
rgba
for normalized/interpolated values - lowercase hex colors and color names (#169)
- fix color minification when hex value replaced for color name (#176)
- fit rgb values to 0..255 range (#181)
- calc
- don't remove units in
flex
property as it could change value meaning (#200) - don't merge
\9
hack values (#231) - merge property values only if they have the same functions (#150, #227)
- don't merge property values with some sort of units (#140, #161)
- fix
!important
issue fortop-right-bottom-left
properties (#189) - fix
top-right-bottom-left
properties merge (#139, #175) - support for unicode-range (#148)
- don't crash on ruleset with no selector (#135)
- tolerant to class names that starts with digit (#99, #105)
- fix background compressing (#170)
Small personal sidenote
We have been using csso
in our building process for years. Not only as CSS compress utility, but also as a parser to get AST, transform it and pass to csso
for compression.
All those years it worked stable enough and various bugs usually were not an issue. I have even rewritten some util functions to use it instead of csso
functions. But project has no maintainer for years. In spite of the opinion that csso
is dead, it has its own audience and number of downloads continues to grow. It's sad that many issues were left with no attention. Moreover I wanted to improve it to make CSS compression results much better and predictable.
That's why I've decided to change the situation. I’m happy that project's owners gave me this opportunity. I became maintainer of csso
and started bringing it back to life.
As a first steps I've changed files structure, cleaned up and refactored most of sources. Now it has single code base, with reworked test suite, jscs
for code style check, browserify
to build the bundle, automated gh-pages
publishing etc. All aim to ensure that nothing prevents us to move forward.
After initial refactoring and a bunch of bug fixes, it's now clear to me that all parts of csso
need to be reworked. First of all compressor's struсtural optimization algorithms should be replaced for others, that are safer, faster and more efficient. Parser should become compliant to standards, with support for new CSS features and more predictable. When this is done, we can try new structural optimizations, that no one has tried before. That is the main reason why I've decided to work on csso
.
Stay tuned!