Penpot design workflow: baseline export, importer plugin, tokens
Mirror to Gitea / mirror (push) Skipped
Mirror to Gitea / mirror (push) Skipped
- tools/penpot/capture.mjs captures every page at 390 and 1440 px as editable layers (text, boxes, images) grouped by section - tools/penpot/plugin: Penpot plugin that rebuilds the captures as native boards; serve.py hosts it locally; preview.html shows the result - tools/penpot/tokens.mjs exports colours and fonts as design tokens - design/README.md documents the design -> hand-off -> code loop
This commit is contained in:
263 files changed
+1054
-1
No files matched your search
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Serve the Penpot importer plugin + captured baseline locally, with CORS.
|
||||
|
||||
python3 tools/penpot/serve.py # then in Penpot: Plugins → install
|
||||
# http://localhost:4402/manifest.json
|
||||
"""
|
||||
import http.server
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
REPO = ROOT.parent.parent
|
||||
PORT = int(os.environ.get('PORT', 4402))
|
||||
|
||||
|
||||
class Handler(http.server.SimpleHTTPRequestHandler):
|
||||
def translate_path(self, path):
|
||||
path = path.split('?', 1)[0]
|
||||
if path.startswith('/baseline/'):
|
||||
return str(REPO / 'design' / path.lstrip('/'))
|
||||
return str(ROOT / 'plugin' / path.lstrip('/'))
|
||||
|
||||
def end_headers(self):
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.send_header('Access-Control-Allow-Private-Network', 'true')
|
||||
self.send_header('Cache-Control', 'no-store')
|
||||
super().end_headers()
|
||||
|
||||
def do_OPTIONS(self):
|
||||
self.send_response(204)
|
||||
self.send_header('Access-Control-Allow-Methods', 'GET, OPTIONS')
|
||||
self.send_header('Access-Control-Allow-Headers', '*')
|
||||
self.end_headers()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(f'Penpot plugin: http://localhost:{PORT}/manifest.json')
|
||||
http.server.ThreadingHTTPServer(('127.0.0.1', PORT), Handler).serve_forever()
|
||||
Reference in new issue
Block a user