Copy Script Tag
A VS Code / Cursor extension that serves your workspace locally and copies a ready-to-paste script/link tag for any file — like Live Server, but for injecting local JS/CSS into any page.

What is Copy Script Tag?
Copy Script Tag is a VS Code / Cursor extension that closes the gap between "I just edited a local file" and "that edit is live on the page I'm testing against." Right-click a .js, .mjs, or .css file in your workspace, choose Copy as Script Tag, and the extension spins up a local static server (if one isn't already running) and copies a ready-to-paste <script> or <link> tag pointing at that exact file straight to your clipboard.
Paste that tag into a Webflow site's custom code panel, a CodePen, a client's <head>, or any local test page, and your in-progress local file is now running on that page — no build step, no deploy, no manual server setup. It's published on the VS Code Marketplace as "Live Script Tag".
The Problem
Testing local JS or CSS against a real, already-built page is a workflow with more friction than it should have. The usual options are: spin up your own local server and remember the port every time, use a browser extension to inject the file, or — worst of all — just paste your code directly into the target site's custom code panel and re-paste every time you make a change.
This shows up constantly in Webflow work. You're iterating on a custom script for a client's site, and the fastest feedback loop would be pointing the site directly at the file on your machine while you edit it. But setting up a static server, getting the CORS headers right, and remembering to switch to HTTPS so the browser doesn't block it as mixed content is enough overhead that most people just skip it and paste code by hand instead.
Copy Script Tag removes that setup entirely. The server starts itself, the tag is already correctly formed, and it's in your clipboard before you've switched windows.
How It Works
The Local Static Server
At the core is server.ts — a minimal static file server built on Node's built-in http/https modules, no framework involved. It serves files from the workspace root, guards against path traversal so it can't be tricked into serving files outside the project, and sets permissive CORS headers so the served file can be loaded from any origin, which matters since the whole point is loading it into pages you don't control.
Building and Copying the Tag
extension.ts is the entry point — it registers the right-click command, manages the server's lifecycle (starting it if it isn't already running, reusing it if it is), builds the tag text based on the file type and configured settings, and writes the result to the clipboard. A status bar item shows when the server is active.
HTTPS for Live Sites
Pasting an http:// script tag into an https:// page — like a live Webflow site — gets blocked as mixed content. certs.ts solves this by checking for, or generating, a local HTTPS certificate via mkcert. With copyScriptTag.useHttps enabled, the server switches to serving over https://localhost, using a cert cached in the extension's global storage, so tags can be pasted straight into HTTPS pages without the browser blocking them. If mkcert isn't installed, the extension surfaces a clear error with the install command rather than failing silently.
Configuration
Everything that matters is exposed as a setting: copyScriptTag.port (default 5510), copyScriptTag.host (default localhost, settable to a LAN IP to test from another device), copyScriptTag.scriptAttributes for extras like defer or type="module", and copyScriptTag.useHttps. Settings are only read at server startup, so a config change while the server is running requires stopping it first from the status bar before the next request picks it up.
Known Limitations
The extension is intentionally scoped to a single, well-defined job rather than trying to be a full dev server. It works with single-root workspaces only, doesn't bundle anything — so it points directly at files as they exist on disk, meaning raw .ts/.jsx files won't resolve without a build step first — and doesn't yet support live-reload. CORS is deliberately wide open (Access-Control-Allow-Origin: *) and every HTTP method is treated like GET, which is fine for a local dev tool and not meant for anything beyond that.
Tech Stack
Built with TypeScript on top of the VS Code Extension API, using Node's native http/https modules for the static server rather than a framework, and mkcert for local HTTPS certificate generation. Packaged and installed as a .vsix via vsce.
Why I Built This
I kept hitting the same wall doing Webflow custom code work: the fastest way to test a script against a real site is to point the site at the file while you're still editing it, but getting a local server running with the right CORS and HTTPS setup every time was enough friction that I'd default to copy-pasting code into the custom code panel instead — slow, and easy to lose track of which version was live.
Copy Script Tag turns that into a single right-click. Start the server, get a correctly formed tag, paste it, and the page is running your local file. It's a small tool that does one specific thing and gets it out of the way.




