GithubHelp home page GithubHelp logo

seek-oss / html-sketchapp-cli Goto Github PK

View Code? Open in Web Editor NEW
632.0 24.0 74.0 101 KB

Quickly generate Sketch libraries from HTML documents and living style guides, powered by html-sketchapp

License: MIT License

JavaScript 64.94% HTML 35.06%
sketch sketchapp sketch-plugin design design-tools design-systems style-guides front-end

html-sketchapp-cli's Introduction

Build Status npm David David semantic-release Commitizen friendly

html-sketchapp-cli

Quickly generate Sketch libraries from HTML documents and living style guides, powered by html-sketchapp and Puppeteer.

Add some simple markup to your page, for example:

<div data-sketch-symbol="Button/Primary">...</div>
<div data-sketch-text="Heading">...</div>
<div data-sketch-color="#212121">...</div>

Then run the html-sketchapp command to generate JSON files in html-sketchapp's "Almost Sketch" format, ready to be imported into Sketch.

$ html-sketchapp --file sketch.html --out-dir dist/sketch

Install

Please note: html-sketchapp-cli requires Node.js and targets the latest "Active LTS" version. Older versions of Node are unsupported.

If you're in a hurry and just want to try it out, you can install html-sketchapp-cli globally, along with html-sketchapp's Sketch plugin:

$ npm install --global html-sketchapp-cli
$ html-sketchapp install

However, when using html-sketchapp-cli in the context of a project, you should install it locally instead:

$ npm install --save-dev html-sketchapp-cli

Then, add some scripts to your package.json:

{
  "scripts": {
    "html-sketchapp-install": "html-sketchapp install",
    "html-sketchapp": "html-sketchapp [...args]"
  }
}

Once these scripts have been added, the following commands can be run within your project:

$ npm run html-sketchapp-install
$ npm run html-sketchapp

Page Setup

Before using this tool, you'll need to add some hooks to your page so that everything can be selected, extracted and named correctly.

Annotate symbols with data-sketch-symbol attributes. Note that forward slashes will create nested menu items within Sketch.

<div data-sketch-symbol="Button/Primary">
  ...
</div>

Annotate nested symbols with data-sketch-symbol-instance attributes, where the attribute values reference existing symbols defined elsewhere in the document.

<div data-sketch-symbol="Icon/Reply">...</div>
<div data-sketch-symbol="Icon/Retweet">...</div>
<div data-sketch-symbol="Icon/Like">...</div>

<div data-sketch-symbol="IconRow">
  <div data-sketch-symbol-instance="Icon/Reply">...</div>
  <div data-sketch-symbol-instance="Icon/Retweet">...</div>
  <div data-sketch-symbol-instance="Icon/Like">...</div>
</div>

Annotate all text styles with data-sketch-text attributes.

<div data-sketch-text="Heading">
  ...
</div>

Annotate all colors with data-sketch-color attributes. Note that colors are unnamed in Sketch, so only the hex value needs to be provided.

<div data-sketch-color="#212121">
  ...
</div>

For a real world example, check out SEEK Style Guide's sketch exports page and the corresponding source code.

CLI Usage

Importing from a local file

If your page is self-contained, you can import from a local HTML file.

$ html-sketchapp --file sketch.html --out-dir dist

Importing from a local static web server

If your page needs to be hosted on a static web server, you can provide a local directory to serve and a root relative URL to import from.

$ html-sketchapp --serve docs --url /sketch --out-dir dist

Importing from existing web server

If your page is hosted on an existing web server, you can provide an absolute URL.

$ html-sketchapp --url http://localhost:3000 --out-dir dist

Viewport sizes and responsive design

If you provide a set of one or more named viewports, every symbol and text style will be rendered for each screen size.

$ html-sketchapp --viewports.Desktop 1024x768 --viewports.Mobile 320x568 --file sketch.html --out-dir dist

If multiple screen sizes are provided, the viewport name will be being appended to all symbol and text style names. For example, Button/Primary will be exported as Button/Primary/Desktop and Button/Primary/Mobile.

Optionally, you can set the pixel density for a given viewport by adding an @ followed by the desired scaling factor to the end of the viewport's resolution. For example, you can simulate a 1.5x and 2x display like so:

$ html-sketchapp --viewports.HigherDensity [email protected] --viewports.Retina 1024x768@2 --file sketch.html --out-dir dist

If no scaling factor is provided, a default of 1 will be used.

Config file

All options can be provided via an html-sketchapp.config.js file.

module.exports = {
  file: 'sketch.html',
  outDir: 'dist/sketch',
  viewports: {
    Desktop: '1024x768',
    Mobile: '320x568'
  },
  puppeteerArgs: '--no-sandbox --disable-setuid-sandbox',
  puppeteerExecutablePath: 'google-chrome-unstable'
};

You can provide an alternate config file path with the --config option.

$ html-sketchapp --config example.config.js

Importing into Sketch

Once this command has successfully run, the following files will be generated in the output directory.

  • document.asketch.json
  • page.asketch.json

These need to be imported into Sketch via html-sketchapp's corresponding Sketch plugin. To ease the install process, you can run the following command.

$ html-sketchapp install

Then, open a new Sketch document and, from the menu, select Plugins > From *Almost* Sketch to Sketch. In the file picker, select both document.asketch.json and page.asketch.json, and click Choose.

Congratulations! You should now have your symbols, text styles and document colors available within Sketch! 💎🎉

Advanced Usage

Debug mode

If you need to see what Puppeteer is doing, you can provide the --debug flag which will do the following things:

  • Turn off headless mode
  • Bring the browser window to the front
  • Forward console calls to the terminal
  • Stop the browser from closing until you exit the CLI tool

For example:

$ html-sketchapp --url http://localhost:3000 --out-dir dist --debug

Puppeteer args

If you need to provide command line arguments to the browser instance via Puppeteer, you can provide the puppeteer-args option.

Since Puppeteer uses Chromium internally, you can refer to the List of Chromium Command Line Switches for available options.

For example, if you'd like to disable the browser sandbox:

$ html-sketchapp --puppeteer-args="--no-sandbox --disable-setuid-sandbox" --file sketch.html --out-dir dist

Note: Because Puppeteer args are prefixed with hyphens, you must use an equals sign and quotes when providing this option via the command line (as seen above).

Puppeteer waitUntil

By default, Puppeteer is configured to consider the page loaded when there are no more than 2 network connections for at least 500ms (networkidle2). This is so that html-sketchapp-cli can handle development environments with long-lived connections.

If the page you're requesting has 2 or fewer resources that stall for longer than 500ms and doesn't complete loading, you can switch back to networkidle0 via the puppeteer-wait-until argument:

$ html-sketchapp --puppeteer-wait-until networkidle0 --file sketch.html --out-dir dist

For the full list of available options for waitUntil, view the Puppeteer page.goto() API documentation.

Chromium executable

If you'd like to override the Chromium used by Puppeteer, you can provide a path to the executable with the puppeteer-executable-path option.

$ html-sketchapp --puppeteer-executable-path google-chrome-unstable --file sketch.html --out-dir dist

Middleware

If you need to call out to lower-level html-sketchapp APIs, you can provide middleware functions that allow you to modify the underlying Sketch classes as they're generated.

It's recommended that you provide middleware via a config file as inline functions, for example:

module.exports = {
  symbolLayerMiddleware: (args) => { ... }
};

Alternatively, you can also provide middleware as standalone JavaScript files, configured via the command line:

$ html-sketchapp --symbol-layer-middleware symbol.layer.middleware.js

This assumes that your middleware is a JavaScript module that exports the function:

module.exports = (args) => { ... };

However, in order to keep the documentation streamlined, all examples will use the config file notation.

Symbol Layer Middleware

This middleware is executed for every layer within a symbol.

The typical use case for this is html-sketchapp's layer.setResizingConstraint API which allows you to configure how a layer should behave when a symbol is resized.

module.exports = {
  symbolLayerMiddleware: args => { ... }
};

The following arguments are passed into your middleware function:

  • layer: the html-sketchapp layer instance
  • SVG: The SVG class for type checking of layer
  • Text: The Text class for type checking of layer
  • Rectangle: The Rectangle class for type checking of layer
  • ShapeGroup: The ShapeGroup class for type checking of layer
  • RESIZING_CONSTRAINTS: Object containing constants for the setResizingConstraint API

For example, when handling SVGs differently from other layers:

module.exports = {
  symbolLayerMiddleware: (args) => {
    const { layer, SVG, RESIZING_CONSTRAINTS } = args;

    layer.setResizingConstraint(RESIZING_CONSTRAINTS.LEFT, RESIZING_CONSTRAINTS.TOP);

    if(layer instanceof SVG) {
      layer.setResizingConstraint(RESIZING_CONSTRAINTS.TOP, RESIZING_CONSTRAINTS.LEFT, RESIZING_CONSTRAINTS.WIDTH, RESIZING_CONSTRAINTS.HEIGHT);
    }
  }
};

Symbol Middleware

This middleware is executed for every symbol within a document.

module.exports = {
  symbolMiddleware: args => { ... }
};

The following arguments are passed into your middleware function:

  • symbol: The current symbol master
  • node: The source HTML node
  • suffix: The symbol name suffix (e.g. /Desktop)
  • RESIZING_CONSTRAINTS: Object containing constants for the setResizingConstraint API

Symbol Instance Middleware

This middleware is executed for every symbol instance within a document.

module.exports = {
  symbolInstanceMiddleware: args => { ... }
};

The following arguments are passed into your middleware function:

  • symbolInstance: The current symbol instance
  • symbolMaster: The symbol master that the symbol instance is referencing
  • node: The source HTML node
  • RESIZING_CONSTRAINTS: Object containing constants for the setResizingConstraint API

Contributing

Refer to CONTRIBUTING.md.

License

MIT.

html-sketchapp-cli's People

Contributors

brianokeefe avatar danielruf avatar markdalgleish avatar michaeltaranto avatar mnikkane avatar mxmul avatar renovate[bot] avatar ryanseddon avatar toolmantim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html-sketchapp-cli's Issues

Absolute paths not supported

First of all, thanks for pushing design systems and the ease of integration and syncing forward. We're working on a design system right now and the Seek Style Guide is a good inspiration. I saw you speak about css-modules at Reactive Conf Bratislava and I've been following your stuff for a long time :)


I tried out html-sketchapp-cli and at first thought it was not working correctly.
Turns out this is because html-sketchapp-cli does not support importing styles from absolute paths.

I had to use a relative path on the exports file to get the styles to work in Sketch:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Sketch Styleguide Import Page</title>
-    <link rel="stylesheet" href="/styles.css" />
+    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <div data-sketch-symbol="Button/Primary">
      <button class="red">Primary Button</button>
    </div>
  </body>
</html>

I resolved the problem by simply using a relative path, so I don't need a fix. However I wanted to make you aware of this.

Expose the node element to symbolLayerMiddleware

We just started using this tool and while it seems to import nicely into sketch, we have encountered a few issues with regard to resizing. We have attempted to use symbolLayerMiddleware to resolve some of our issues, but basing constraints on what the layer object contains limits our ability to determine what/how constraints should be applied.

My suggestion is that the dom node used to create the layer be exposed to symbolLayerMiddleware to allow the user more control over configuration of the layer.
It will also align the layer middleware with the symbol and symbolInstance versions in that they already expose the dom node.

I can submit a PR of this change if it seems appropriate to the design of this project.

cli.js syntax error running install command

I'm on a mac running macOS 10.13.4 (17E202) Kernel Version:Darwin 17.5.0 and when I run the html-sketchapp install command in terminal I am getting this error message kicked back.

/usr/local/lib/node_modules/html-sketchapp-cli/bin/cli.js:64
}, async argv => {
^^^^^
SyntaxError: missing ) after argument list
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

install fails, cannot find module puppeteer

$ node -v && npm -v
v8.11.1
5.8.0

Using Ubuntu Bash in Windows 10

$ npm install --global html-sketchapp-cli
/root/.nvm/versions/node/v8.11.1/bin/html-sketchapp -> /root/.nvm/versions/node/v8.11.1/lib/node_modules/html-sketchapp-cli/bin/cli.js

> [email protected] install /root/.nvm/versions/node/v8.11.1/lib/node_modules/html-sketchapp-cli/node_modules/puppeteer
> node install.js

module.js:471
    throw err;
    ^

Error: Cannot find module '/root/.nvm/versions/node/v8.11.1/lib/node_modules/html-sketchapp-cli/node_modules/puppeteer/install.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:496:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-07-19T10_13_15_468Z-debug.log

This works on git-bash though :( , using npx does not help. I also tried to install puppeteer globally, no luck

Timeout with local html file

I was just testing something out simple with this and plugged in a basic html file

<!DOCTYPE html>
<html lang="en">
  <title> </title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://unpkg.com/tachyons/css/tachyons.min.css">
  <body>
    <button data-sketch-symbol="Button/Primary" class="bw1-l br2 bg-dwyl-teal pa2 white fw1 tc ttu tracked">do what you love</button>
    <div data-sketch-text="Heading" class="f1 fw7 sans-serif lh-title">Headline 1</div>
    <div data-sketch-text="Body" class="sans-serif lh-copy">Body</div>
    <div data-sketch-color="#A463F2" class="pa4 bg-light-purple">&nbsp;</div>
  </body>
</html>

I followed the readme, but I'm getting a timeout error. Am I missing something?

$ npm install --global html-sketchapp-cli
$ html-sketchapp --file index.html --out-dir .
Error: Timeout
    at Timeout._onTimeout (/usr/local/lib/node_modules/html-sketchapp-cli/node_modules/wait-on/lib/wait-on.js:92:10)
    at ontimeout (timers.js:458:11)
    at tryOnTimeout (timers.js:296:5)
    at Timer.listOnTimeout (timers.js:259:5)

Timeout when generating from a Storybook story

When generating from a local Storybook server, you receive a request timeout error:

$ html-sketchapp --url 'http://localhost:6006/iframe.html?selectedKind=Sketch&selectedStory=Export' --out-dir dist
{ TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded
    at Promise.then (buildkite/frontend/node_modules/puppeteer/lib/NavigatorWatcher.js:94:21) name: 'TimeoutError' }

Storybook keeps a webpack HMR event-stream socket open. Switching from networkidle0 to networkidle2 fixes it.

Given networkidle2 is the recommended default event to use these days anyhow, perhaps you'd be open to a PR that replaces networkidle0 with networkidle2?

Aside from this one glitch, this works perfectly w/ Storybook — you just create a story with a big Sketch export sheet, and point the CLI directly at it 👌🏼

Export works, not importing into Sketch

Hey, saw Mark's talk featured at React Amsterdam and was psyched to try this.

I'm able to export Sketch JSON file, but they don't import anything into Sketch.

I tried using Styled Components, CSS-based, and I even just copied the HTML/CSS/JS from the seek-oss master component page and nothing imports into Sketch (no new libraries under New Symbol).

Here is a link to my example repo. I setup a basic Gatsby project (to generate the static HTML from React components), and use gatsby build to generate HTML from the pages/component.js file (with a list of components, wrapped in divs with data-attributes). Running npm run sketch:build targets the static component HTML file and generates the Sketch JSON into the /sketch/ folder (you can find my exports there).

Not sure how to debug this further since the generated/exported JSON looks accurate, the Sketch plugin just isn't pulling it in correctly. Not sure if this should be in the html-sketchapp repo in that case? I can definitely cross-post this there as well.

Process

  1. Generate Sketch JSON (either from custom HTML or seek-oss boilerplate).
  2. Open Sketch, create new document.
  3. Go to Plugins > From Almost > Import files
  4. Pick files
  5. Nothing happens?

Specs

  • OSX 10.13.6
  • Sketch 52.5

multiple urls

it would be sweet if the CLI could support multiple urls and then to output a single json file with all the data across all the urls

Error: EISDIR when running `npm run html-sketchapp-install`

My environment:

$ node -v && npm -v                              
v11.15.0
6.11.3

I'm trying to install html-sketchapp-cli but I'm running into issues. I've looked through the other issues here on github, but I don't think any are related? It's likely I'm doing something wrong, or my environment is not set up correctly, but I wonder if anyone can help?

Firstly I installed html-sketchapp with npm i @brainly/html-sketchapp. Then I installed html-sketchapp-cli into a simple test project using npm install --save-dev html-sketchapp-cli. Then I ran the npm run html-sketchapp-install script as directed in the readme.

However, running html-sketchapp-install fails with the following error:

$ npm run html-sketchapp-install

> [email protected] html-sketchapp-install /Users/mpkb/Sites/html-sketchapp
> html-sketchapp install

Detected html-sketchapp v4.4.0
Downloading from http://github.com/brainly/html-sketchapp/releases/download/v4.4.0/asketch2sketch-4-4-0.sketchplugin.zip
Extracting to /Users/mpkb/Sites/html-sketchapp/node_modules/html-sketchapp-cli/.tmp
Detected html-sketchapp v4.4.0
html-sketchapp install

Install the html-sketchapp Sketch plugin

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]
  --config   Path to JavaScript config file

{ [Error: EISDIR: illegal operation on a directory, open '/Users/mpkb/Sites/html-sketchapp/node_modules/html-sketchapp-cli/.tmp/asketch2sketch-4-4-0.sketchplugin/Contents/']
  errno: -21,
  code: 'EISDIR',
  syscall: 'open',
  path:
   '/Users/mpkb/Sites/html-sketchapp/node_modules/html-sketchapp-cli/.tmp/asketch2sketch-4-4-0.sketchplugin/Contents/' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] html-sketchapp-install: `html-sketchapp install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] html-sketchapp-install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mpkb/.npm/_logs/2019-11-18T15_53_09_481Z-debug.log

My limited knowledge would suggest that the script thinks asketch2sketch-4-4-0.sketchplugin is a file, when in fact it's a directory?...

Any suggestions?

SyntaxError: missing ) after argument list

I am getting the error below after installing the plugin.

/usr/local/lib/node_modules/html-sketchapp-cli/bin/cli.js:59
}, async argv => {
^^^^^
SyntaxError: missing ) after argument list
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

Not able to perform consistent sync of Sketch Library File

Hey there,

to be honest, I'm blown away how easily this turns my html into sketch symbols. Big props for that.

Let me explain what I'm struggling with:

  1. I turn a html file into the asketch.json file
  2. I trigger the sketch plugin and select both files
  3. I save that file
  4. I link the saved filed in the preferences as a library
  5. I create a new file and use the symbols from the library
  6. I update the html and perform step 1-3

I'd expect to have this
image
in my sketch but it does not appear. I'm able to use the updated symbols from the library but already used symbols are not updated.

Do you know this issue or how to fix it?

thanks for the awesome work <3

get-installed-path is failing to find html-sketchapp

Error message I get upon html-sketchapp install

(node:6987) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: get-installed-path: module not found "html-sketchapp" in path /Users/jayfallon/.nvm/versions/node/v8.1.4/lib/node_modules/html-sketchapp
(node:6987) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Support of inner Sketch features via data-sketch-{feature} attribute

Similar to issue Using specific data attributes for Sketch.

Feature description
Make some inner Sketch features avaliable in the way like this: <div data-sketch-locked>This group is locked in Sketch</div>

We have already implemented some attributes here → handleSymbolAttributes.js @servicetitan/html-sketchapp/st-dev

So these attributes, that we have been working on (bugs to be found!):

  1. data-sketch-constraints="align left, fixed width"
  2. data-sketch-rotation="18deg"
  3. data-sketch-padding="10px 16px" (with Paddy plugin)
  4. data-sketch-spacing="10h 12v" (with Paddy plugin)
  5. data-sketch-textlabel="First name"
  6. data-sketch-locked=true
  7. data-sketch-ungroup=true

Only buttons show out

Hi, I just tried it and it only showed out buttons in my Sketch app. Is there something wrong with my html file? Thanks.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
  <link rel="stylesheet" href="style_guides.css">
</head>
<body>
  	<div data-sketch-symbol="Buttons/Primary"><button class='btn primary'>Button</button></div>
    <div data-sketch-symbol="Buttons/Secondary"><button class='btn secondary'>Button</button></div>
	<div data-sketch-text="Heading"><span class='hero-txt'><span>Hero text.</span></span></div>
    <div data-sketch-text="Heading" class='heading-txt'>Heading text</div>
    <div data-sketch-text="Heading" class='subheading-txt'>Subheading text</div>
    <h6>@jh-blue-pink</h6>
    <div data-sketch-color="#e60278" class='pink'></div>
	<h6>@jh-blue-lighter</h6>
    <div data-sketch-color="#2765cf" class='blue-lighter'></div>
</body>
</html>

Need help rendering

Trying to do a test of just basic elements but the import draws them like below. How do I obtain a better conversion. Looking at the seek-oss style guide there are quite a few svgs. Should I be using svgs instead?

Thanks

image

image

I also tried with boostrap 3 css and got the following.

image

<!DOCTYPE html>
<html lang="en">
<head class="html5reset-bare-bones">
    <!-- Latest compiled and minified CSS -->

    <style type="text/css">
        .symbol_text {
            color: mediumpurple;
        }
    </style>
</head>

<body class="container">

<h1>
    Physician
</h1>
<br><br>

<table class="table">
    
    <tr>
        <td>
            <div data-sketch-symbol="Physician/firstname/Variable/641d4e8d-0a65-43e2-b07f-18f1aed2eae4" class="symbol_text">
                Firstname
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Physician/firstname/Dropdown" class="symbol_dropdown">
                <div class="form-group">
                    <label for="" class="">
                        <strong class="">Firstname</strong></label><br>
                    <select class="form-control">
                        <option value="" disabled="">Placeholder text</option>
                    </select>

                </div>
            </div>
            </div>
        </td>
        <td>
            <div class="form-group" data-sketch-symbol="Physician/firstname/Radio">
                <label class="">
                    <input class="" type="radio"/>
                    <span class="">firstname</span>
                </label>
            </div>
        </td>
        <td>
            <div class="checkbox" data-sketch-symbol="Physician/firstname/Checkbox">
                <label>
                    <input class="" type="checkbox"/>
                    <span class="">firstname</span>
                </label>
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Physician/firstname/TextField">
                <div class="form-group">
                    <label for=""><strong class="">Firstname</strong></label><br>
                    <input type="text" class="" placeholder="Firstname" value="">
                </div>
            </div>
        </td>
        <td>
            <div class="form-group">
                <label for=""><strong class="">Firstname</strong></label><br>
                <div data-sketch-symbol="Physician/firstname/Textarea">
                    <textarea class="form-control">firstname text area</textarea>
                </div>
            </div>
        </td>
    </tr>
    
    <tr>
        <td>
            <div data-sketch-symbol="Physician/lastname/Variable/99bc8845-a9e1-49d6-9c8e-fdb4bdbf823a" class="symbol_text">
                Lastname
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Physician/lastname/Dropdown" class="symbol_dropdown">
                <div class="form-group">
                    <label for="" class="">
                        <strong class="">Lastname</strong></label><br>
                    <select class="form-control">
                        <option value="" disabled="">Placeholder text</option>
                    </select>

                </div>
            </div>
            </div>
        </td>
        <td>
            <div class="form-group" data-sketch-symbol="Physician/lastname/Radio">
                <label class="">
                    <input class="" type="radio"/>
                    <span class="">lastname</span>
                </label>
            </div>
        </td>
        <td>
            <div class="checkbox" data-sketch-symbol="Physician/lastname/Checkbox">
                <label>
                    <input class="" type="checkbox"/>
                    <span class="">lastname</span>
                </label>
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Physician/lastname/TextField">
                <div class="form-group">
                    <label for=""><strong class="">Lastname</strong></label><br>
                    <input type="text" class="" placeholder="Lastname" value="">
                </div>
            </div>
        </td>
        <td>
            <div class="form-group">
                <label for=""><strong class="">Lastname</strong></label><br>
                <div data-sketch-symbol="Physician/lastname/Textarea">
                    <textarea class="form-control">lastname text area</textarea>
                </div>
            </div>
        </td>
    </tr>
    
    <tr>
        <td>
            <h3 class="">Action Physician</h3>
            <div data-sketch-symbol="Physician/Button/Action">
                <button class="btn btn-default">ACTION</button>
            </div>
        </td>
        <td>
            <h3 class="">Save Physician</h3>
            <div data-sketch-symbol="Physician/Button/Save">
                <button class="btn btn-primary">SAVE</button>
            </div>
        </td>
        <td>
            <h3 class="">Delete Physician</h3>
            <div data-sketch-symbol="Physician/Button/Delete">
                <button class="btn btn-danger">REMOVE</button>
            </div>
        </td>
        <td colspan="3"></td>
    </tr>

</table>

<h1>
    Location
</h1>
<br><br>

<table class="table">
    
    <tr>
        <td>
            <div data-sketch-symbol="Location/city/Variable/e08e6b7f-938b-45e9-bd4d-dd6eb8b50851" class="symbol_text">
                City
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Location/city/Dropdown" class="symbol_dropdown">
                <div class="form-group">
                    <label for="" class="">
                        <strong class="">City</strong></label><br>
                    <select class="form-control">
                        <option value="" disabled="">Placeholder text</option>
                    </select>

                </div>
            </div>
            </div>
        </td>
        <td>
            <div class="form-group" data-sketch-symbol="Location/city/Radio">
                <label class="">
                    <input class="" type="radio"/>
                    <span class="">city</span>
                </label>
            </div>
        </td>
        <td>
            <div class="checkbox" data-sketch-symbol="Location/city/Checkbox">
                <label>
                    <input class="" type="checkbox"/>
                    <span class="">city</span>
                </label>
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Location/city/TextField">
                <div class="form-group">
                    <label for=""><strong class="">City</strong></label><br>
                    <input type="text" class="" placeholder="City" value="">
                </div>
            </div>
        </td>
        <td>
            <div class="form-group">
                <label for=""><strong class="">City</strong></label><br>
                <div data-sketch-symbol="Location/city/Textarea">
                    <textarea class="form-control">city text area</textarea>
                </div>
            </div>
        </td>
    </tr>
    
    <tr>
        <td>
            <div data-sketch-symbol="Location/state/Variable/8f553d7f-7cf8-41cb-9a97-9c2a15325cef" class="symbol_text">
                State
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Location/state/Dropdown" class="symbol_dropdown">
                <div class="form-group">
                    <label for="" class="">
                        <strong class="">State</strong></label><br>
                    <select class="form-control">
                        <option value="" disabled="">Placeholder text</option>
                    </select>

                </div>
            </div>
            </div>
        </td>
        <td>
            <div class="form-group" data-sketch-symbol="Location/state/Radio">
                <label class="">
                    <input class="" type="radio"/>
                    <span class="">state</span>
                </label>
            </div>
        </td>
        <td>
            <div class="checkbox" data-sketch-symbol="Location/state/Checkbox">
                <label>
                    <input class="" type="checkbox"/>
                    <span class="">state</span>
                </label>
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Location/state/TextField">
                <div class="form-group">
                    <label for=""><strong class="">State</strong></label><br>
                    <input type="text" class="" placeholder="State" value="">
                </div>
            </div>
        </td>
        <td>
            <div class="form-group">
                <label for=""><strong class="">State</strong></label><br>
                <div data-sketch-symbol="Location/state/Textarea">
                    <textarea class="form-control">state text area</textarea>
                </div>
            </div>
        </td>
    </tr>
    
    <tr>
        <td>
            <div data-sketch-symbol="Location/addressline1/Variable/d27103c0-0de7-49f7-9d05-48188e77998a" class="symbol_text">
                Addressline1
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Location/addressline1/Dropdown" class="symbol_dropdown">
                <div class="form-group">
                    <label for="" class="">
                        <strong class="">Addressline1</strong></label><br>
                    <select class="form-control">
                        <option value="" disabled="">Placeholder text</option>
                    </select>

                </div>
            </div>
            </div>
        </td>
        <td>
            <div class="form-group" data-sketch-symbol="Location/addressline1/Radio">
                <label class="">
                    <input class="" type="radio"/>
                    <span class="">addressline1</span>
                </label>
            </div>
        </td>
        <td>
            <div class="checkbox" data-sketch-symbol="Location/addressline1/Checkbox">
                <label>
                    <input class="" type="checkbox"/>
                    <span class="">addressline1</span>
                </label>
            </div>
        </td>
        <td>
            <div data-sketch-symbol="Location/addressline1/TextField">
                <div class="form-group">
                    <label for=""><strong class="">Addressline1</strong></label><br>
                    <input type="text" class="" placeholder="Addressline1" value="">
                </div>
            </div>
        </td>
        <td>
            <div class="form-group">
                <label for=""><strong class="">Addressline1</strong></label><br>
                <div data-sketch-symbol="Location/addressline1/Textarea">
                    <textarea class="form-control">addressline1 text area</textarea>
                </div>
            </div>
        </td>
    </tr>
    
    <tr>
        <td>
            <h3 class="">Action Location</h3>
            <div data-sketch-symbol="Location/Button/Action">
                <button class="btn btn-default">ACTION</button>
            </div>
        </td>
        <td>
            <h3 class="">Save Location</h3>
            <div data-sketch-symbol="Location/Button/Save">
                <button class="btn btn-primary">SAVE</button>
            </div>
        </td>
        <td>
            <h3 class="">Delete Location</h3>
            <div data-sketch-symbol="Location/Button/Delete">
                <button class="btn btn-danger">REMOVE</button>
            </div>
        </td>
        <td colspan="3"></td>
    </tr>

</table>

</body>

</html>

html-sketchapp install error

Hi @markdalgleish,

Just trying this out for the first time and ended up with this error:

html-sketchapp install
(node:67759) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): ValidationError: child "resources" fails because ["resources" must not be a sparse array]
(node:67759) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:67759) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: get-installed-path: module not found "html-sketchapp" in path /Users/jcummins/.nvm/versions/node/v8.9.3/lib/node_modules/html-sketchapp

I was able to run the cli and got a dist with the asketch.json files but couldn't get the plugin to install in sketch.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @brainly/html-sketchapp ^4.0.0
  • commitlint-config-seek ^1.0.0
  • eslint-config-seek ^4.0.0
nvm
.nvmrc
travis
.travis.yml

  • Check this box to trigger a request for Renovate to run again on this repository

Syntax error while html-sketchapp install

SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)

Looked into the issue #5.
Looks like this one is different issue

Do nested symbols work?

I am trying to create nested symbols but html-sketchapp-cli is instead creating a separate symbol for the containing element. For example, assume this is the generated output:

<div data-sketch-symbol="Container">
    <div data-sketch-symbol="Item/Red">A</div>
    <div data-sketch-symbol="Item/blue">B</div>
    <div data-sketch-symbol="Item/Green">C</div>
    <div data-sketch-symbol="Item/Brown">D</div>
    <div data-sketch-symbol="item/Cornflowerblue">E</div>
</div>

The current behaviour creates a separate Container symbol without the Item symbols nested within it. Is there a separate prop for the same that is undocumented?

Clarification, where does `data-sketch-colors` appear in Sketch?

With this code:

<div class="gb-row" data-sketch-symbol="Colors/Main">
  <div class="gb-col-12--xs">
    <div class="rlx-palette">
      ...
      <div class="rlx-palette-itemHolder">
        <strong class="rlx-palette-itemText">Crème brûlée, <em>#FFE49C</em></strong>
        <div class="rlx-palette-item rlx-color rlx-color-brand rlx-color-yellow" data-sketch-color="#FFE49C"></div>
      </div>
      ...
    </div>
  </div>
</div>

Where does the colors appear in sketch? The symbol Colors/Main appears, but I can't see to locate where the colors are at. If I check "document colors" in the right pane for an element, it is empty.

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.