filesize.macro
v0.1.1
Published
Calculate filesize at build time
Downloads
4
Maintainers
Readme
filesize.macro
Webpack
filesize-loader
implemented asbabel-plugin-macros
Usage
Similar to nodejs require
call:
import filesize from "filesize.macro";
const size = filesize("./image.jpg");
Example of usage in create-react-app
import coverImage from "./cover-image.jpg";
import filesize from "filesize.macro";
const coverSize = filesize("./cover-image.jpg");
const SomeComponent = () => (
<div>
<a href={coverImage}>{`Image size ${coverSize} in bytes`}</a>
</div>
);
Credits
Based on pveyes/raw.macro.
License
MIT