v4.0.0
Breaking changes
-
Minimum support is now Node 10+, please use datauri 3 for previous versions.
-
CSS
-
rename
class
config toclassName
-
rename
background-size
config tobackgroundSize
-
Isolate
getCSS
indatauri/css
submoduleBefore (getCSS function)
const datauri = require('datauri'); datauri('test/myfile.png', (err, content, meta) => { meta.getCSS({ class: "myClass", 'background-size': true, width: true, height: true })); });
After (datauri/css)
const datauriCSS = require('datauri/css'); await datauriCSS('test/myfile.png', { className: "myClass", backgroundSize: true, width: true, height: true });
-
-
CLI
-
fs promises instead of Sync function
-
background-size
flag renamed tobackgroundSize
-
class
flag renamed toclassName
Before
datauri brand.png --css --class=MyNewClass --background-size
After
datauri brand.png --css --className=MyNewClass --backgroundSize
-
Dev experience
- Migrate TravisCI to Github actions
- create devcontainer file for Github Codespaces
- format code with prettier
- master branch renamed to
main
Performance tweaks
- CSS parser runs a single fs read operation
- datauri parser by default do not use any external dependencies because image-size is now isolated in
datauri/css
submodule. - uses Node.js fs native promises instead of factoring it with utils