Webpack
lqip-loader
implemented asbabel-plugin-macros
Similar to nodejs require
call:
import lqip from "lqip.macro";
const preview = lqip("./image.jpg");
import coverImage from "./cover-image.jpg";
import lqip from "lqip.macro";
const coverLqip = lqip("./cover-image.jpg");
const SomeComponent = () => (
<div
style={{
backgroundImage: `url(${coverLqip}`,
backgroundSize: "cover",
backgroundRepeat: "no-repeat"
}}>
<img src={coverImage} alt="" width="100%" height="100%"/>
</div>
);
Based on pveyes/raw.macro.
MIT