sqip.macro

0.1.0 • Public • Published

sqip.macro

Build Status Babel Macro

Webpack sqip-loader implemented as babel-plugin-macros

Usage

Similar to nodejs require call:

import sqip from "sqip.macro";
 
const preview = sqip("./image.jpg");

Example of usage in create-react-app

import coverImage from "./cover-image.jpg";
import sqip from "sqip.macro";
const coversqip = sqip("./cover-image.jpg");
 
const SomeComponent = () => (
  <div
    style={{
      backgroundImage: `url(${coversqip}`,
      backgroundSize: "cover",
      backgroundRepeat: "no-repeat",
    }}
  >
    <img src={coverImage} alt="" width="100%" height="100%" />
  </div>
);

Credits

Based on pveyes/raw.macro.

License

MIT

/sqip.macro/

    Package Sidebar

    Install

    npm i sqip.macro

    Weekly Downloads

    3

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    16 kB

    Total Files

    9

    Last publish

    Collaborators

    • stereobooster