Giter VIP home page Giter VIP logo

vcwb-demo-element-example-plugin's Introduction

Demo plugin with custom elements for Visual Composer Website Builder

This is a Demo (example) plugin for developers to showcase custom elements. It acts as a sandbox for developers. To see it in action download and install it on your WordPress instance along with the Visual Composer Website Builder plugin.

Requirements

  • node > 8.0, recommended latest
  • PHP > 5.4, recommended latest (7.2)

Installation

  • Clone this repository git clone https://github.com/VisualComposer/vcwb-demo-element-example-plugin.git to wp-content/plugins directory
  • Go to the plugin page in your wp admin area and activate the plugin
  • That's it. You can open the editor and find new plugin elements here.

Element update

  • Run yarn install in the element directory
  • Build via yarn build in the element directory
  • Once an element is built it will appear in the Visual Composer editor

What is an element?

An element is the independent part of the system which represents HTML based block with the ability to output media and dynamic content.

How does it work?

The editor works with elements as React components. These components must be built with webpack and enqueued by API. Every element has a preview image, thumbnail image, category and React-based component.

Element content

Each element contains

  • manifest.json - describes element data, preview image, thumbnail image, category and PHP files
  • package.json - yarn install/update files for required node modules
  • webpack.config files to build a component with webpack

Directory {tag} (must be renamed to the element tag name):

  • cssMixins directory โ€“ cssMixin.pcss: POSTCSS file that holds mixin for custom generated style
  • public directory โ€“ may contain custom CSS, JS, and images for public view
  • index.js - the main file, build with webpack
  • component.js - ReactJS component contains Visual Composer editor component. NOTE: This component is used only in the editor, not the View Page
  • settings.json - Describes element attributes
  • *.php files - Required PHP files(must be described in ../manifest.json)
  • editor.css - CSS file which will be used only in the editor
  • style.css - CSS file which will be used on the frontend to display content

Commands

yarn install // Install all the element dependencies
yarn build // Builds development build
yarn watch // Watches & Builds development version on file modification
yarn build-production // Builds the minified build

lessc elementName/public/src/init.less elementName/styles.css // compile LESS source file to CSS output
../../node_modules/.bin/webpack --config=webpack.config.js -p // minify JS file for public use inside elementName/public folder

Resources for Visual Composer API:

vcwb-demo-element-example-plugin's People

Contributors

nikitahl avatar say2me avatar pavelthq avatar konutis avatar veidenbaums avatar olegapanovich avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.