@cultureamp/kaizen-binary-assets
v1.2.1
Published
Binary asset management for Culture Amp's Kaizen Design System.
Readme
Kaizen Binary Assets
Binary asset management for Culture Amp's Kaizen Design System.
API
assetUrl(path)
Returns the full URL of the asset at path managed by the
kaizen-design-system-assets service.
TypeScript/JavaScript
assetUrl("some/blob.png") // -> "https://<origin>/some/blob.png"SCSS
asset-url("some/blob.png") // -> "https://<origin>/some/blob.png"If you want to use an image
- Make sure the image exists in the
kaizen-design-system-assetsrepo. If it doesn't, make a PR to add it (ask the Design Systems team for review). Images in this repo will be automatically uploaded and made available via a CloudFront distribution. - Make sure that the
@cultureamp/kaizen-binary-assetspackage is in your repo'spackage.json. This package provides you theassetUrlfunction that translates the path to the file in thekaizen-design-system-assetsrepo into its equivalent CloudFront URL. - Import the
index.tsorindex.scssfile and you can access the image through theassetUrl/asset-urlfunction:
// JS
import assetUrl from "@cultureamp/kaizen-binary-assets/lib/index.ts";
<SomeComponent image={assetUrl("illustrations/ham.png")} />// SCSS
@import "~@cultureamp/kaizen-binary-assets/lib/index.scss";
.coolpic {
background-image: url(asset-url("illustrations/ham.png"));
}