# How to split my 9.5K lines of index.html?

**URL:** <https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009>\
**Category:** Release Discussions\
**Created:** [July 5, 2025, 3:17pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009 "2025-07-05T15:17:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.AB](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Mr.AB](https://forum.cursor.com/u/Mr.AB)\
**Post date:** [July 5, 2025, 3:17pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/1 "2025-07-05T15:17:33Z")

</div>

Hey guys,

after adding all my features and working for a few months with cursor on this web app, now I’m sitting on 11k lines of code inside one Index.html. However, I was able to move 1.5k lines of CSS into .css files.

However right now I’m stuck with 9.5k lines of HTML + JS included.  
for the past 6hrs I’ve used tons of AI to try and split them up to no avail. I ended up with many working functions, but app is heavily broken. restored app right now and lookin what can I do?

---

<div class="post-metadata">

**Author:** ![thepKz](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/thepkz/32/31508_2.png) [@thepKz](https://forum.cursor.com/u/thepKz)\
**Post date:** [July 5, 2025, 3:27pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/2 "2025-07-05T15:27:19Z")

</div>

bro don’t depend on AI 🙂 If you want to split it, go to youtube to know what is external css. Just ctrl c + ctrl v.

---

<div class="post-metadata">

**Author:** ![Mr.AB](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Mr.AB](https://forum.cursor.com/u/Mr.AB)\
**Post date:** [July 5, 2025, 3:32pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/3 "2025-07-05T15:32:48Z")

</div>

lol thanks, but I know how to split both CSS and JS. I was just looking into how can I let Ai do that for me, since I got around 7k lines of JS in that index with many Ai generated functions

---

<div class="post-metadata">

**Author:** ![thepKz](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/thepkz/32/31508_2.png) [@thepKz](https://forum.cursor.com/u/thepKz)\
**Post date:** [July 6, 2025, 2:06am UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/4 "2025-07-06T02:06:22Z")

</div>

You cant, the context is too large.

---

<div class="post-metadata">

**Author:** ![JimKarter](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@JimKarter](https://forum.cursor.com/u/JimKarter)\
**Post date:** [July 6, 2025, 3:23am UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/5 "2025-07-06T03:23:05Z")

</div>

split script tag into single js file then ask AI to refactor it to mutiple js file in functional perspective

```auto
index.html
components┬ui.js
          ├event-coordinator.js
          ├api-fetcher.js
          ├dom-helper.js
          ├sanitizer.js
          ├styles.js
          └template.js

```

something like this

---

<div class="post-metadata">

**Author:** ![Artemonim](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/artemonim/32/56113_2.png) [@Artemonim](https://forum.cursor.com/u/Artemonim)\
**Post date:** [July 6, 2025, 4:45am UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/6 "2025-07-06T04:45:17Z")

</div>

> [@Mr.AB](#):
>
> I’ve used tons of AI to try and split them up to no avail

- Have you tried asking the AI how to split this file?
- Have you tried asking the AI what you’re doing wrong?

---

<div class="post-metadata">

**Author:** ![Mr.AB](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Mr.AB](https://forum.cursor.com/u/Mr.AB)\
**Post date:** [July 6, 2025, 2:40pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/7 "2025-07-06T14:40:10Z")

</div>

Thanks, I’m trying to do this right now. My JS file is 7k lines which is going to be very tough, but its worth it. Whats a sweet spot for JS files? 100-500 lines?

---

<div class="post-metadata">

**Author:** ![Mr.AB](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Mr.AB](https://forum.cursor.com/u/Mr.AB)\
**Post date:** [July 6, 2025, 2:42pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/8 "2025-07-06T14:42:19Z")

</div>

- I did, it gave me a very clear plan  
we went through it, the issue is without claude 4, claude 3.5 messes the process up so bad since the file is huge. GPT 4 just destroys more than builds.

So in this case, I either wait for Claude 4 to reset in the new month, or try and suffer trying to split with 3.5 and pray

---

<div class="post-metadata">

**Author:** ![Artemonim](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/artemonim/32/56113_2.png) [@Artemonim](https://forum.cursor.com/u/Artemonim)\
**Post date:** [July 6, 2025, 3:19pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/9 "2025-07-06T15:19:49Z")

</div>

Upload the entire file to the Gemini context and ask it to build a Roadmap for breaking down the project into separate modules.

---

<div class="post-metadata">

**Author:** ![Artemonim](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/artemonim/32/56113_2.png) [@Artemonim](https://forum.cursor.com/u/Artemonim)\
**Post date:** [July 6, 2025, 3:22pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/10 "2025-07-06T15:22:04Z")

</div>

You can also try applying my Agent Docstrings to your file - it’s specifically designed to help the AI navigate large files. Don’t forget to save your code through Git before applying it.

> **[GitHub - Artemonim/AgentDocstrings: A command-line tool to auto-generate and update...](https://github.com/Artemonim/AgentDocstrings)**
>
> A command-line tool to auto-generate and update file-level docstrings summarizing classes and functions. Useful for maintaining a high-level overview of your files, especially in projects with code generated or modified by AI assistants.

Just ask the Agent to add this thing to the project and run it on your file.

---

<div class="post-metadata">

**Author:** ![JimKarter](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@JimKarter](https://forum.cursor.com/u/JimKarter)\
**Post date:** [July 6, 2025, 6:46pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/11 "2025-07-06T18:46:18Z")

</div>

It’s really depends on how your 7K lines of your code have what functional perspective. Yes, 100-500 lines that’s ideal.  
In my project, I refoctored 2.3K lines of Typescript ui.ts into multiple ts file but ui-refoctored.ts have still 1.4K of code. Claude 4 Sonnet says “These codes are heaveliy related each other so leave them as it is”. Well, so I leave it as it is. Anyway I should compile source code via vite, so it is maybe same. Final output will be giant single \*.es.js file.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [May 26, 2026, 12:41pm UTC](https://forum.cursor.com/t/how-to-split-my-9-5k-lines-of-index-html/114009/12 "2026-05-26T12:41:52Z")

</div>


