Skip to content

Installation ​

Using npm

bash
npm i @youcan/js

Or you can use cdn

html
<script src="https://unpkg.com/@youcan/js@latest/dist/index.umd.js"></script>

Usage ​

npm ​

ts
import youcanjs from '@youcan/js';

const youcan = youcanjs.init();

const categories = await youcanjs.category.fetchAll();

CDN ​

In order for the sdk to work properly, it's highly recomended to place the script tag at the end of the head tag. If you're using liquid template engine for the theme, make sure to place the SDK script tag after the content_for_header tag.

html
<html>
    <head>
        ...
        {{ content_for_header }}
        ...
        <script src="https://unpkg.com/@youcan/js@latest/dist/index.umd.js"></script>
    </head>
    <body>
        ...
        <script>
            const categories = await youcanjs.category.fetchAll();
        </script>
    </body>
</html>