GithubHelp home page GithubHelp logo

presto-dom-code's Introduction

Presto-Dom-Gen

A Sketch plugin that copies selected layers to the clipboard as code that can be pasted straight into a UI .purs file.

  • Copy one or more layers
  • Layers are copied in position
  • Text, group and rectangle layers are turned entirely in code
  • Image layers too are generated and exported @3x

Install

Download or clone the repository, and double click Presto-Dom-Gen.sketchplugin.

What layer types can the plugin handle?

Rectangles

Here is an example of the code that will be generated when you select a rectangle showing the full set of properties that can be generated:

linearLayout
  [ height $ V 100 
  , width $ V 200
  , background "#FF18294E"
  , stroke "1,#FFFFFFFF"
  , cornerRadius 4
  ][]

Text

Text is copied as a native text layer:

textView
  [ height $ V 19 
  , width $ V 235
  , text "There’s a lot to share with others…"
  , fontStyle "Gilroy-Medium"
  , textSize 16
  , color "#9B9B9B"
  , letterSpacing (-0.33)
  ]

Groups

Groups are copied as native linearLayout:

linearLayout
  [ height $ V 300
  , width $ V 400
  ][]

What layer styles can the plugin handle?

  • Opacity
  • Background
  • Border
  • CornerRadius
  • FontStyle, FontSize, FontWeight
  • Height, Width
  • Gravity
  • ImageUrl
  • Text
  • Kerning

How include image assets

When the design of a layer cannot be represented using native code you will need to use an image asset:

imageView
  [ height $ V 200 
  , width $ V 200
  , imageUrl "avatar"
  ]

Here’s how:

  1. Select the layer in Sketch and press 'CMD SHIFT P'

  2. Enter the ImageUrl and press ok, it will be used to generate the asset naming and in generation imageView -> imageUrl.

presto-dom-code's People

Contributors

iarthstar avatar

Watchers

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