The element is the independent part of the system which represents HTML based block with the ability to output media and dynamic content.
The editor works with elements as React components. These components must be built with webpack and enqueued by API. Every element has preview, thumbnail, category and React-based component.
Elements contains
- manifest.json - describes element data, preview, thumbnail, category and php files.
- package.json - npm install/update files for required node modules
Directory {tag} (must be renamed to src):
- index.js - the main file, build with Webpack
- component.js - ReactJs component contains VCWB editor component. This component is used only in the editor.
- settings.json - Describes element attributes
- *.php files - Required PHP files(must be described in ../manifest.json)
- editor.css - CSS files which will be used only in the editor
- style.css - CSS files which will be used on the frontend to display content.
- cssMixins - directory that holds POSTCSS (*.pcss) files with mixin for custom generated styles
- node > 10.0, recommended latest
- PHP > 7.0, recommended latest
- To work with the element, each element is independent
- Run
yarn install
in the element directory - Build via
yarn build
- Once the element is built it will appear in the editor
yarn install // Install all the element dependencies (must be same as visualcomposer)
yarn build // Build development build
yarn watch // Watches & Build development version on file modification
yarn build-production // Builds the minified build