Skip to content

3.2. Containers

Antonio Bašić edited this page Mar 4, 2020 · 1 revision

Containers hold content elements inside of Tailor. This feature gives an easy way to develop and configure new containers.

Development

Set up

A template exists which can be used to create the basic structure for a content element. It can be found here along with instructions on how to get started with it.

Files

Below is a rundown of all the files located in the template and what their purpose is.

index.js

index.js is the file used by Tailor's front-end build process to include the container. This file must exist.

info.js

info.js is a file that contains basic information about this container which can be useful to the front-end and the back-end. This file does not need to exist but then its contents need to be found in any file that needs them (index.js and util.js in this template use it).

util.js

util.js is a file used by the back-end to handle unique, not trivial statics resolution scenarios. This file must exist but only one of the methods is required; the fetch method.

edit/index.vue

index.vue is the file used by the front-end to display the container. This file needs to exist in some form but it does not need to be in an edit folder or with this name. The only requirement is that it is imported in the index.js file as Edit.

Configuration

There needs to be an index.js file inside of the content-elements folder for Tailor to load any custom container. If such file does not exist it needs to be created first and it should look like this:

module.exports = [];

For Tailor to use any custom element the name of the folder that contains the custom container. It should look something like this:

module.exports = ['<name-of-folder-given-to-degit>'];