Automated workflow for scraping site UIs and rebuilding them in Framer via browser or CLI automation.
This tool automates the process of:
- Scraping HTML, CSS, and image assets from any website (default: kodexalabs.space)
- Processing and formatting the content for Framer
- Injecting the code into Framer Workshop to create code components
Perfect for quickly prototyping existing designs or migrating web UIs into Framer projects.
- π Full Website Scraping: Extracts HTML structure, CSS styles, and image assets
- πΈ Screenshot Capture: Takes full-page screenshots for reference
- π¨ Style Extraction: Captures both inline and external CSS styles
- πΌοΈ Asset Management: Downloads and organizes images and other assets
- π§© Framer Component Generation: Creates ready-to-use Framer code components
- π€ Browser Automation: Uses Puppeteer or Playwright for reliable automation
- π Manual Fallback: Generates code files if automatic injection fails
- Node.js >= 16.0.0
- npm or yarn
- A modern web browser (Chrome/Chromium recommended)
- Clone the repository
git clone https://github.com/kodexalabs/framer-ui-scrape-injector.git
cd framer-ui-scrape-injector
- Install dependencies
npm install
This will install:
- Puppeteer (browser automation)
- Playwright (alternative automation tool)
- Axios (HTTP requests)
- Cheerio (HTML parsing)
- dotenv (environment configuration)
- Configure environment (optional)
Create a .env
file in the project root:
TARGET_URL=https://kodexalabs.space
USE_PLAYWRIGHT=false
Run both scraping and injection in one command:
npm run full-workflow
npm run scrape
This will:
- Launch a headless browser
- Navigate to the target URL (default: kodexalabs.space)
- Extract all HTML, CSS, and images
- Save everything to the
scraped-output/
directory - Take a full-page screenshot
Output files:
scraped-output/scraped-data.json
- Complete scraped datascraped-output/page.html
- HTML structurescraped-output/styles.css
- Combined CSSscraped-output/screenshot.png
- Full page screenshotscraped-output/assets/
- Downloaded images
npm run inject
This will:
- Generate Framer-compatible React code
- Launch a browser window
- Navigate to Framer Projects
- Wait for you to open a project and code editor
- Attempt to automatically inject the code
- Save a
.tsx
component file as fallback
Manual steps during injection:
- Log in to Framer when prompted
- Open or create a project
- Open the Code panel (Workshop)
- Create a new code component
- Wait for the script to inject the code
TARGET_URL=https://example.com npm run scrape
USE_PLAYWRIGHT=true npm run inject
node scraper.js
node inject-framer.js
The tool generates a React component like this:
import React from "react"
import { addPropertyControls, ControlType } from "framer"
export default function ScrapedComponent(props) {
return (
<div
style={{
width: "100%",
height: "100%",
backgroundColor: "#ffffff",
color: "#000000",
fontFamily: "system-ui, sans-serif",
// ... extracted styles
}}
>
<div dangerouslySetInnerHTML={{ __html: `...` }} />
</div>
)
}
framer-ui-scrape-injector/
βββ package.json # Dependencies and scripts
βββ scraper.js # Website scraping script
βββ inject-framer.js # Framer injection script
βββ README.md # This file
βββ .gitignore # Git ignore rules
βββ .env # Environment configuration (create this)
βββ scraped-output/ # Generated by scraper
βββ scraped-data.json # Complete scraped data
βββ page.html # HTML structure
βββ styles.css # Combined CSS
βββ screenshot.png # Page screenshot
βββ framer-component.tsx # Generated Framer component
βββ assets/ # Downloaded images
Browser won't launch:
# Install Chromium manually
node node_modules/puppeteer/install.js
Timeout errors:
- Increase timeout in
scraper.js
(line withtimeout: 30000
) - Check your internet connection
- Verify the target URL is accessible
Code not injecting automatically:
- The script saves a
.tsx
file inscraped-output/
- Manually copy and paste the code into Framer
- Ensure you've opened the code editor before the injection attempt
Framer login required:
- The script pauses for 30 seconds to allow manual login
- Complete the login process during this time
- The script will continue automatically
- Design Migration: Move existing websites into Framer
- Rapid Prototyping: Quickly recreate designs you find online
- Component Libraries: Extract and adapt UI patterns
- Learning: Study how other sites are built
- Client Work: Speed up the process of rebuilding client sites
- Start Simple: Test with simple pages before complex sites
- Review Output: Always review and clean up the generated code
- Style Refinement: The extracted styles may need manual adjustment
- Image Optimization: Consider optimizing downloaded images
- Responsive Design: You may need to add responsive breakpoints manually
- Component Splitting: Break large components into smaller, reusable pieces
β οΈ Only scrape websites you have permission to scrape- Respect robots.txt and terms of service
- Don't use scraped content commercially without permission
- Be mindful of copyright and intellectual property
- Use for learning and prototyping purposes
- JavaScript-heavy sites may not render completely
- Some CSS-in-JS styles might not be captured
- Complex animations may need manual recreation
- External fonts may need separate handling
- CORS restrictions may prevent some asset downloads
# Watch for changes
npm run scrape -- --watch
# Debug mode
DEBUG=true npm run scrape
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this tool for personal and commercial projects.
kodexalabs
- GitHub: @kodexalabs
- Support for multiple page scraping
- Advanced CSS selector filtering
- Interactive CLI with prompts
- Direct Framer API integration (when available)
- Component style property controls generation
- SVG extraction and optimization
- Font file downloading and bundling
- Framer Motion animation detection
- Responsive breakpoint extraction
- Dark mode style detection
Q: Do I need a Framer account? A: Yes, you'll need a Framer account to use the injection feature.
Q: Will this work with any website? A: Most websites will work, but heavily JavaScript-dependent sites may have limitations.
Q: Can I customize the scraping behavior?
A: Yes, edit scraper.js
to customize selectors, filters, and extraction logic.
Q: Is the generated code production-ready? A: The code is a starting point. Review and refine it for production use.
Q: Can I scrape multiple pages at once? A: Not currently, but this is planned for a future update.
Happy scraping! π
If you find this tool useful, please star the repository and share it with others!