Publishing components

After building your components, it is time to use it on your website. First things first, install first the Sitecloud CLI on your machine:

npm i -g @sitecloud/cli

Now connect to your account with:

sc login

The Sitecloud login page will show up on your browse, sign in and close the browser if you want.

Next step is to bundle your component, the starter-component is already prepared to do this, now execute this command to start bundling:

yarn build

Alright, it is now time to publish the component to Sitecloud. At this moment, all components published are only accessible for you but keep in mind to not expose any private key or information on your components source code. Now, change the directory to your component source code apth and publish it with next command:

sc components publish

You can go now to Sitecloud, open your browser and go to https://app.sitecloud.net/ as usual. In the top navigation bar there is a section named Components where all your published components will be listed. Notice that each one of your components are versioned, if you want to republish a component you will need to change the version in the package.json file of the component and publish again using the previous command.

Component libraries

We are now in the last steps, we need now to link your component to desired projects. Only Studio projects can use custom components, if you have not created one first, go to the main page and click on Start creating a new website or follow this link https://app.sitecloud.net/new.

Open now your project and click on the Components tab:

Linking component

Find your available and previously published components on the right column, and notice in the left column that you don't have any linked components to this project yet. Click on the desired component and it will appear in the left column as linked. Now everything is settled, come back to the Studio editor and your component will appear in the toolbar, just drag and drop to the canvas:

Linking component