
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
enhance-css
Advanced tools
A well-tested CSS enhancer (Base64, assets hosts, cache boosters, etc)
Enhance-css is a node.js tool which can tweak your CSS files to:
There is also an option to create non-embedded version suited well for older browsers (IE 7 and below).
node.js 0.8.0+ (fully tested on OS X 10.6+, CentOS, and Windows 7)
npm install enhance-css
enhancecss [options] [source-file]
-h, --help output usage information
-v, --version output the version number
-r, --root [root-path] Set a root path to which resolve absolute @import rules
-o, --output [output-file] Use [output-file] as output instead of STDOUT
--crypted-stamp Rename image files with MD5 hash attached (hard cache boosters)
--no-stamp Disable adding stamp to URLs
--no-embed-version Output both embedded and non embedded version
--force-embed Forces embed on all supported assets
--asset-hosts [host-pattern] Use one or more asset hosts, e.g assets[0,1,2].example.com
--pregzip Automatically gzip the enhanced files (not available when no output file given)
Most likely you are going to pass multiple CSS files into it and specify root directory and output file, e.g.
cat path/to/first.css path/to/second.css path/to/third.css | enhancecss -o bundled.css --root ./public/
The --root
parameter is required to properly locate images referenced in the css files.
To embed images in Base64 just add the embed argument to the image url, e.g.
a { background: url(/images/arrow.png?embed) 0 0 no-repeat; }
In case you also need to support older browser, just add --noembedversion
parameter, e.g.
cat path/to/first.css path/to/second.css path/to/third.css | enhancecss -o bundled.css --root ./public/ --noembedversion
which will result in two output files: bundled.css and bundled-noembed.css.
To use one or more asset hosts, just specify --assetshosts
parameter, e.g.
cat path/to/first.css path/to/second.css path/to/third.css | enhancecss -o bundled.css --root ./public/ --assethosts assets[0,1].example.com
which will result in all non-embedded image URLs bound to either assets0.example.com or assets1.example.com.
First clone the source, then run:
npm run check
to check JS sources with JSHintnpm test
for the test suiteEnhance-css is released under the MIT License.
FAQs
A well-tested CSS enhancer (Base64, assets hosts, cache boosters, etc)
The npm package enhance-css receives a total of 175 weekly downloads. As such, enhance-css popularity was classified as not popular.
We found that enhance-css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.