Coder Social home page Coder Social logo

therakeshpurohit / vue-plugin-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jackiecorn/vue-plugin-template

0.0 0.0 0.0 428 KB

Figma Plugin Template for Vue

License: MIT License

JavaScript 11.05% TypeScript 0.93% HTML 0.01% Vue 0.69% CSS 87.32%

vue-plugin-template's Introduction

Vue Plugin Template for Figma

Features:

  • Vue
  • Typescript
  • Pug
  • figma-plugin-ds integration
  • Message handler helper functions to simplify communication between the main code and the UI code

How to use?

  1. Install dependencies with yarn.
  2. Run yarn dev and a folder named dist will be created.
  3. In the Figma desktop app, click on Create new plugin -> Link existing plugin and point it to the manifest.json in this project.
  4. Now you can edit the main Figma code from src/code.ts and the UI code from src/ui.vue. Hitting save will auto-reload the build so you can see your changes right away.
  5. When you're ready to publish the plugin, run yarn build to create a production build.

Message handlers

To communicate between the main code and the UI code, you can use the dispatch and handleEvent functions to send and listen to messages between the two environments.

Sending a message from the main code to UI code:

dispatch('eventName', data)

Handling messages from the UI code to the main code:

handleEvent('eventName', data => {
// Do something with the data
})

Note that data is optional so you could simply send a message by dispatch('eventName').

In the vue UI code, dispatch can be called anywhere, but handleEvent functions should be called in mounted() so they would only be called first and only once.

This project template shows an example of a UI button sending a message to the main code to create a rectangle node. The main code then sends back the created node ID to be displayed in the UI.

vue-plugin-template's People

Contributors

jackiecorn 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.