react-figma

3. boilerplate μ„€μΉ˜ 및 μ‹€ν–‰

방금 μ„€μΉ˜ν•œ boilerplate ν”„λ‘œμ νŠΈλ₯Ό VSCODE둜 μΌ  λ‹€μŒ

npm install
npm webpack:watch

μ°¨λ‘€λ‘œ μž…λ ₯ν•΄μ£Όλ©΄ dist폴더가 λ§Œλ“€μ–΄μ§„λ‹€.

4. ν”Όκ·Έλ§ˆμ— ν”ŒλŸ¬κ·ΈμΈ μ—°κ²°

ν”Όκ·Έλ§ˆ 쒌츑 λ©”λ‰΄μ—μ„œ Draftλ₯Ό λˆ„λ₯Έλ‹€.

우츑 λ©”λ‰΄μ—μ„œ Plugins > Manage Plugins 클릭

In Developmentμ—μ„œ Create your own plugin μ˜† + 클릭

(μš°λ¦¬λŠ” 이미 λ§Œλ“€μ–΄μ§„ boilerplateλ₯Ό ν”Όκ·Έλ§ˆμ— μ—°κ²°ν• κ²ƒμ΄λ―€λ‘œ μƒˆλ‘œ μƒμ„±ν•˜λŠ”κ²Œ μ•„λ‹ˆλΌ 기쑴에 μžˆλŠ”κ±Έ μ—°κ²°ν•˜λŠ”κ²ƒμž„)

μ•„λž˜ choose a manifest.json 클릭

manifest.json 파일 선택후 μ™„λ£Œ

이제 react-figma ν”ŒλŸ¬κ·ΈμΈμ΄ μ •μƒμ μœΌλ‘œ ν”Όκ·Έλ§ˆλ‘œ μ—°κ²°λ˜μ—ˆλ‹€.

이제 μ½”λ“œλ₯Ό λ³€κ²½ν–ˆμ„λ•Œ ν”Όκ·Έλ§ˆμ—μ„œ μ œλŒ€λ‘œ λ Œλ”λ§ λ˜λŠ”μ§€ μ•Œμ•„λ³΄μž.

Draft둜 λ‹€μ‹œ κ°€μ„œ 우츑 메뉴λ₯Ό λˆ„λ₯Έλ‹€μŒ 방금 μΆ”κ°€ν•œ ν”ŒλŸ¬κ·ΈμΈμ„ μ„ νƒν•œλ‹€.

이런 화면이 λ–΄λ‹€λ©΄ 성곡

λ‹€μ‹œ vscode둜 λŒμ•„κ°€μ„œ μ½”λ“œλ₯Ό μˆ˜μ •ν•΄λ³΄μž.

src/App.tsx의 μ½”λ“œμ—μ„œ μ•„λž˜ Rectangle의 색을 yellow둜 λ°”κΏ”λ³΄μž.

import * as React from "react";
import { Page, Rectangle, Text } from "react-figma";

export const App = () => {
    return (
        <Page isCurrent name="Page X">
            <Text characters="Hello, react-figma!" />
            <Rectangle style={{ width: 200, height: 100, backgroundColor: "#0ddd25" }} />
            <Rectangle style={{ width: 200, height: 100, backgroundColor: "yellow" }} /> // yellow둜 변경됨.
        </Page>
    );
};

λ‹€μ‹œ ν”Όκ·Έλ§ˆλ‘œ λŒμ•„κ°€μ„œ

Run Last Plugin을 λˆ„λ₯΄κ±°λ‚˜ Ctrl + Alt + P(μœˆλ„μš°), βŒ₯⌘P(λ§₯)을 ν†΅ν•΄μ„œ ν”ŒλŸ¬κ·ΈμΈμ„ μž¬μ‹€ν–‰μ‹œμΌœλ³΄μž.

μ •μƒμ μœΌλ‘œ λ³€κ²½λ˜μ—ˆμœΌλ©΄ 성곡

Last updated

Was this helpful?