Skip to content

v4.0.0

Compare
Choose a tag to compare
@heldr heldr released this 08 Aug 16:40
· 3 commits to main since this release

Breaking changes

  • Minimum support is now Node 10+, please use datauri 3 for previous versions.

  • CSS

    • rename class config to className

    • rename background-size config to backgroundSize

    • Isolate getCSS in datauri/css submodule

      Before (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 to backgroundSize

    • class flag renamed to className

      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