Install
via NPM
Install from NPM.
npm install @deepar/beauty
Import as ES6 module.
import * as Beauty from "@deepar/beauty"
Fetch from CDN
Fetch from jsDelivr.
<script src="https://cdn.jsdelivr.net/npm/@deepar/beauty"></script>
Alternatively, you can import DeepAR as an ES6 module.
Via <script type='module'>
.
<script type='module'>
import * as Beauty from 'https://cdn.jsdelivr.net/npm/@deepar/beauty/dist/beauty-deepar.esm.js';
</script>
Or via dynamic import.
const deepar = await import('https://cdn.jsdelivr.net/npm/@deepar/beauty/dist/beauty-deepar.esm.js');
Install DeepAR
DeepAR Beauty works on top of DeepAR. Please install it and set it up first. There is a free license for development and testing.
Initialize Beauty API
Initialize DeepAR first.
const deepAR = await deepar.initialize({
licenseKey: "your_license_key_here",
previewElement: document.querySelector('#deepar-div')
})
Then initialize DeepAR Beauty.
const beauty = await Beauty.initializeBeauty(deepAR, "https://cdn.jsdelivr.net/npm/@deepar/beauty/dist/");
You must provide a path to the root directory of
the DeepAR Beauty library. That path will be used to fetch all assets.
The easiest way is to provide a path to jsDelvr DeepAR Beauty package.
Just make sure to pass the correct package version. The other way is to
copy the whole DeepAR Beauty library directory from node_modules
to dist
and pass a relative path to the copied directory.