npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

remove-lovable-tags

v1.0.0

Published

A production-ready CLI tool to remove Lovable-related artifacts from exported frontend projects

Readme

remove-lovable-tags

A production-ready CLI tool to automatically remove all Lovable-related artifacts from exported frontend projects — leaving behind clean, deployment-ready HTML.

npm version license node


Why?

When you export a project from Lovable (or similar AI-powered frontend builders), the output HTML often contains builder-specific artifacts:

  • Custom elements like <lovable>, <lovable-badge>, <lovable-section>
  • Proprietary data-lovable-* attributes on your elements
  • CDN references to Lovable's runtime scripts and stylesheets
  • Builder-injected <meta> tags, comments, and config <script> blocks

These artifacts are harmless during development but they ship unnecessary bytes and expose tooling details in production. This CLI removes all of them safely, without breaking your HTML structure.


Quick Start

# Run on your project without installing
npx remove-lovable-tags

# Or install globally
npm install -g remove-lovable-tags
remove-lovable-tags

By default, the tool processes index.html in the current directory and creates an index.backup.html backup.


Installation

npm install -g remove-lovable-tags

Usage

remove-lovable-tags [options]

Options

| Flag | Description | Default | |------|-------------|---------| | -p, --path <dir> | Project directory to scan | process.cwd() | | -f, --file <path> | Process a single HTML file | — | | -d, --dry-run | Preview changes, don't modify files | false | | --no-backup | Skip backup file creation | — | | --all | Scan all HTML files (not just index.html) | false | | --prettify | Prettify the cleaned HTML output | false | | --verbose | Show detailed logs for each change | false | | -v, --version | Print version | — |

Examples

# Clean index.html in the current directory (with backup)
remove-lovable-tags

# Preview what would change — safe to run anywhere
remove-lovable-tags --dry-run

# Clean a specific directory
remove-lovable-tags --path ./my-exported-project

# Clean a specific file
remove-lovable-tags --file ./public/index.html

# Clean all HTML files recursively
remove-lovable-tags --all

# Clean + prettify output + skip backup
remove-lovable-tags --prettify --no-backup

# Verbose output to see exactly what's removed
remove-lovable-tags --verbose --dry-run

What Gets Removed

Custom Elements

| Input | Output | |-------|--------| | <lovable><div>Hello</div></lovable> | <div>Hello</div> (unwrapped) | | <lovable-badge /> | (removed entirely) | | <lovable-section><section>…</section></lovable-section> | <section>…</section> (unwrapped) |

Smart rule: if a Lovable element wraps real content, the content is preserved. If it's a self-closing tooling element with no meaningful content, it's fully removed.

Attributes

Removed from any element:

  • data-lovable
  • data-lovable-* (any variant)
  • Any attribute whose name contains "lovable"
<!-- Before -->
<div class="hero" data-lovable-component="Hero" data-lovable-editable="true">

<!-- After -->
<div class="hero">

Scripts

<!-- Removed -->
<script src="https://cdn.lovable.dev/v1/lovable-runtime.js"></script>
<script src="https://analytics.lovable.dev/tracker.js"></script>
<script>
  window.__LOVABLE_CONFIG__ = { projectId: 'proj_abc123' };
</script>

<!-- Kept (your app code) -->
<script type="module" src="/assets/main-bundle.js"></script>

Stylesheets

<!-- Removed -->
<link rel="stylesheet" href="https://cdn.lovable.dev/v1/lovable-ui.css" />

<!-- Kept -->
<link rel="stylesheet" href="/assets/index-abc123.css" />

Meta Tags & Comments

<!-- Removed -->
<meta name="generator" content="Lovable (https://lovable.dev)" />
<meta name="lovable-project-id" content="proj_abc123" />

<!-- Removed -->
<!-- lovable: hot reload in dev mode -->
<!-- lovable editor overlay — remove before deploy -->

Before & After

Before (index.html from Lovable export):

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="generator" content="Lovable (https://lovable.dev)" />
    <meta name="lovable-project-id" content="proj_abc123" />
    <link rel="stylesheet" href="https://cdn.lovable.dev/v1/lovable-ui.css" />
    <script src="https://cdn.lovable.dev/v1/lovable-runtime.js" defer></script>
  </head>
  <body data-lovable-version="1.4.2">
    <lovable>
      <div class="app-root" data-lovable-component="AppRoot">
        <h1>Hello World</h1>
      </div>
    </lovable>
    <lovable-badge position="bottom-right"></lovable-badge>
    <script>window.__LOVABLE_CONFIG__ = { projectId: 'proj_abc123' };</script>
    <script type="module" src="/assets/main.js"></script>
  </body>
</html>

After (remove-lovable-tags):

<!DOCTYPE html>
<html lang="en">
  <head>
  </head>
  <body>
    <div class="app-root">
      <h1>Hello World</h1>
    </div>
    <script type="module" src="/assets/main.js"></script>
  </body>
</html>

Architecture

remove-lovable-tags/
├── bin/
│   └── cli.js              # CLI entry point (commander)
├── src/
│   ├── index.js            # Public library API
│   ├── transformer.js      # HTML transformation logic (cheerio)
│   ├── processor.js        # File orchestration (read → transform → write)
│   ├── fs-utils.js         # File system utilities
│   └── logger.js           # Colored CLI output (chalk)
└── test-fixtures/
    └── index.html          # Example Lovable-exported file for testing

Design Principles

  1. No regex for HTML — all DOM manipulation uses cheerio, a fast jQuery-like HTML parser. This ensures structural correctness even with nested or malformed tags.

  2. Smart unwrapping — Lovable wrapper elements that contain real content have the wrapper removed but children preserved. This keeps your layout intact.

  3. Conservative inline script removal — inline <script> blocks are only removed if they're clearly Lovable-specific (short, containing only Lovable config). Long or complex scripts are never touched.

  4. Atomic file writes — files are written to a temp path then renamed, so a crash mid-write never corrupts your source.

  5. Non-destructive by default — a .backup.html file is always created unless you opt out with --no-backup.


Using as a Library

import { transformHtml, processProject } from 'remove-lovable-tags';

// Transform an HTML string directly
const { html, stats } = transformHtml(rawHtml);
console.log(`Removed ${stats.removedScripts.length} scripts`);

// Process an entire directory
await processProject({
  projectPath: '/path/to/project',
  dryRun: false,
  backup: true,
  prettify: false,
  verbose: true,
});

transformHtml(html, options?){ html, stats }

| Field | Type | Description | |-------|------|-------------| | html | string | Cleaned HTML output | | stats.removedElements | string[] | Fully removed element descriptions | | stats.unwrappedElements | string[] | Unwrapped wrappers (children kept) | | stats.removedAttributes | string[] | Stripped attribute descriptions | | stats.removedScripts | string[] | Removed <script> tags | | stats.removedLinks | string[] | Removed <link> tags | | stats.removedComments | string[] | Removed HTML comments | | stats.removedAssetRefs | string[] | Asset URLs that were referenced |


Requirements

  • Node.js ≥ 18.0.0
  • Works on macOS, Linux, and Windows

License

MIT