@brainly/html-sketchapp

中文文档
4.5.0发布于 2021/01/13MITTypeScriptCommonJS近 30 天下载 1.1万

HTML to Sketch

原始使用文档
文档目录9 节
  1. What it can do?
  2. Why?
  3. Limitations
  4. How do I run it?
  5. Install html-sketchapp
  6. Create .asketch files
  7. Import .asketch files to Sketch
  8. Projects using html-sketchapp
  9. Standing on the shoulders of giants :heart:

html-sketchapp Build Status npm version MIT license npm downloads

HTML to Sketch export solution.

html-sketchapp

What it can do?

html-sketchapp turns HTML nodes into Sketch layers or symbols. Additionally, it allows to export shared text styles and document colors.

Why?

The motivation behind this project was ability to easily share Front-End style guide with our Design team. Although similar project, react-sketchapp, already exists it does require you to:

  • use React,
  • build everything using generic components (<View>, <Text>, <Image>),
  • and keep your styles in JS.

We were unable to quickly work around these limitations, so we created html-sketchapp.

You can learn more about this project from:

Limitations

Comprehensive summary of what is, and what is not supported can be found here, but the TLDR is as follows:

  • pseudoelements are not supported,
  • some CSS properties (e.g. overflow) are not supported or not fully supported,
  • not all types of images are supported (animated gifs, webp),
  • resizing information is not generated,
  • all fonts have to be locally installed.

The good news is that all of those are fixable and that we welcome pull requests ❤️

How do I run it?

Install html-sketchapp

You can get stable version of html-sketchapp from NPM.

npm i @brainly/html-sketchapp

Create .asketch files

html2asketch is a library that you can use to create a script that extracts specific parts of your website and saves them as layers, shared text styles, document colors and symbols. Your script then can be run in a regular or a headless browser.

There is no one right way of using html2asketch, but you can start by checking out the "Usage Examples" section of the wiki or the two example projects that we provide:

  • html-sketchapp-example - minimal script that takes an URL and produces a page.asketch.json file
  • html-sketchapp-style-guide - script that takes parts of the Brainly style-guide and exports them as Sketch symbols, shared text styles and document colors. This script produces document.asketch.json and page.asketch.json.

If you are wondering what are, and why we need .asketch files, plese see our wiki.

Import .asketch files to Sketch

All .asketch.json files should be loaded to Sketch via the asketch2sketch.sketchplugin plugin.

Installing Sketch plugin

You can download ready to use Sketch plugin from the "Releases" section, or build it yourself from the sources:

npm i # install dependencies
npm run build # build the plugin

Projects using html-sketchapp

  • html-sketchapp-cli - "Quickly generate Sketch libraries from HTML documents and living style guides."
  • story2sketch - "Convert Storybook stories into Sketch symbols."
  • UIengine - "Workbench for UI-driven development."
  • Alva - "Alva is a radically new design tool that enables cross-functional teams to design digital products"
  • FAST-DNA - "A set of tooling, resources, and components used to accelerate building Web sites and applications."
  • HTML to Sketch - "You can draw a website in an open sketch window."

Standing on the shoulders of giants :heart:

This project uses huge bits and pieces from the fantastic react-sketchapp and wouldn't be possible without skpm and information from Sketch-Headers.

版本与发布记录

@brainly/html-sketchapp 共发布 21 个版本,首次发布于 2018/03/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.5.0latest2021/01/135 年前
4.4.12020/09/306 年前
4.4.02019/11/156 年前
4.3.02019/08/237 年前
4.2.02019/03/027 年前
4.1.02018/12/187 年前

关于 @brainly/html-sketchapp 的常见问题

@brainly/html-sketchapp 是什么?

HTML to Sketch

如何安装 @brainly/html-sketchapp?

在项目目录运行 npm install @brainly/html-sketchapp,或使用 pnpm add / yarn add / bun add。

@brainly/html-sketchapp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@brainly/html-sketchapp 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@brainly/html-sketchapp 可以商用吗?

@brainly/html-sketchapp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@brainly/html-sketchapp 的下载量有多少?

根据 npm 官方下载统计,@brainly/html-sketchapp 在 2026/10/09 – 2026/11/07 这 30 天内被下载 10,664 次,日均约 355 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@brainly/html-sketchapp 还在维护吗?

最新版本 4.5.0 发布于 2021/01/13(5 年前);至今共发布 21 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/03/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。