postcss-b64i

postcss plugin insert inline base64 assets file

Usage no npm install needed!

<script type="module">
  import postcssB64i from 'https://cdn.skypack.dev/postcss-b64i';
</script>

README

Inline base64 image

body {
  background: inline-image-files('../assets/img/logo.png') no-repeat top left transparent;
}
body {
  background: url(data:imageimage/png;base64,...) no-repeat top left transparent;
}

Font-face base64 inline font

@font-face{
    font-family:"Roboto";
    font-style:normal;
    font-weight:100;
    src:inline-font-files('../fonts/roboto/roboto-thin.woff2') format("woff2");
}	
@font-face{
    font-family:"Roboto";
    font-style:normal;
    font-weight:100;
    src:url(data:application/font-woff2;base64,....) format("woff2");
}	

Usage

postcss([ require('postcss-b64i') ])

See [PostCSS] docs for examples for your environment.