jbleuzen / node-cssmin Goto Github PK
View Code? Open in Web Editor NEWA little node module that minimize CSS Files
A little node module that minimize CSS Files
This expression (css blur for Firefox) :
.blur
{
filter: url('data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><filter id="gaussian_blur"><feGaussianBlur in="SourceGraphic" stdDeviation="4" /></filter></defs></svg>#gaussian_blur');
}
Is minified like this :
.blur{filter:url("data:image/svg+xml;utf8,<svgversion=\"1.1\"xmlns=\"http://www.w3.org/2000/svg\"xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><filterid=\"gaussian_blur\"><feGaussianBlurin=\"SourceGraphic\"stdDeviation=\"4\"/></filter></defs></svg>#gaussian_blur")}
Spaces are removed where they should not : "svg version", "filter id", etc...
;) would be really cool !
cssmin ignore DXImageTransform !
Input
p{
opacity: 0;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
filter: alpha(opacity=0);
}
Output
p{opacity:0;-ms-filter:alpha(opacity=0);filter:alpha(opacity=0)}
http://node-cssmin/ is not a valid URL.
Can this be added, please?
Looked through the source - can this be documented in the README, please?
If I try to minify font awesome css
https://github.com/FortAwesome/Font-Awesome/blob/master/css/font-awesome.css
node.js hangs with 100% cpu usage.
Anyway, thanks for the module :)
Just a suggestion, but why not do:
exports = cssmin;
That way, you could use it just like:
var cssmin = require('cssmin');
Makes it just a little nicer, and I can't imagine you'd need to export other things in the future.
Piping to a file is different in Windows verses Mac/Linux, so it'd be really helpful to have a -o
option.
Hello,
cssmin is logging output to stderr
or exiting with non-zero exit code, which is causing an error to be logged in our Maven build process, even though it completes fine, e.g.:
[INFO] $ run-p build:js build:css -s
[INFO] $ node-sass app/index.scss dist/foo.css --quiet
[INFO] $ postcss dist/foo.css -o dist/foo.css --use autoprefixer -b 'last 2 versions'
[ERROR] โ Finished dist/foo.css (361 ms)
[INFO] Done in 10.47s.
I've tried to look for a CLI option to silence logging but couldn't find any. Is there any way to supress these success log messages?
pre:before { content: " surrounded by ten spaces "; }
gets clobbered to
pre:before { content: " surrounded by ten spaces "; }
which, needless to say, doesn't produce the same end effect. You probably have to apply at least some css grammar parsing for cssmin to be safe. (As a bonus side effect, that would also allow some further optimization like removing the space between a selector and its {}, though.)
See https://jsfiddle.net/wb5ogcjc/ for why these spaces are necessary. Right now, "@supports not (foo)" gets compressed to "@supports not(foo)" which doesn't work as per the fiddle (and the CSS standard).
#19 fixes this.
the npm docs still say to require('cssmin').cssmin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.