In-depth practical guides

Clean a web project without breaking the site

Separate served files, required data and working artifacts: reduce a project while preserving useful pages, languages and media.

Updated :

File and table checks at an organised workstation.

AI-generated illustration

What evidence makes a file safe to remove?

An old name, large size or missing text reference is insufficient. A catalog key may select an image, CSS may load a font, and a shared function may read JSON. Begin with actual uses and retain a recovery path. Define the file scope explicitly and leave secrets, access details and sensitive configuration untouched.

  1. Classify uses

    Separate public routes, shared code, data, served media, production sources and temporary output. Record file counts and bytes by group. A public article about an audit remains website content; a local test report may be an artifact. Classify by function rather than filename.

  2. Trace dependencies

    Inspect includes, imports, CSS URLs, scripts, metadata and manifests. Reconstruct dynamically assembled names using page keys, languages, image suffixes or profile identifiers. Test variants, error pages and empty states. Include social sharing resources and exports, beyond visible images.

  3. Define candidates

    Record location, size, reason, searched references and possible dependencies for each candidate. Compare originals with optimized variants: an original may support production even when it is not served. Decide what stays in the project and what can be retained separately before removal.

  4. Prepare recovery

    Keep a recoverable copy of the relevant items in suitable storage outside the public directory. Identify the matching website version. A file ignored by Git is not automatically backed up or excluded from deployment. Check version tracking, published package and recovery archive separately.

  5. Remove in batches

    Start with identified artifacts, then replaced libraries and media with established dependencies. Verify absolute paths and remain within the announced scope. Repeat the same tasks after each batch. Do not remove data or security files simply because they are not public.

  6. Check the result

    Repeat routes and languages, search, filters, tools, forms and error states. Check srcset, preloads, CSS and resources loaded after interaction. Compare project bytes before and after. Disk savings are not necessarily transfer savings: an unused file was not being downloaded by the browser.

  7. Check uses beyond navigation

    Extend the inventory to generation commands, imports, maintenance tasks and known direct access. A file may rebuild the site without any browser requesting it. Identify its producer and consumer, then distinguish source material, reproducible output and an archive needed for recovery.

Reading workshop

A removal candidate needs an evidence record

The DEMO inventory is fictional and read-only. It neither authorizes nor triggers deletion in this project.

Fictional data and records for learning: none of these results comes from a live service query.

No exact string does not mean no use

A team examines CSS assembled from a language key, an old page name in an index, a generation tool and a test screenshot. Their consumers determine their role, not their appearance.

  1. Reconstruct the reference

    Fictional candidate
    styles-{language}.css
    Evidence or dependency
    The full name is assembled at runtime
    Prepared decision
    Keep; check languages and actually loaded stylesheets.
  2. Check derived outputs

    Fictional candidate
    Old URL in search and sitemap
    Evidence or dependency
    These lists can still expose the page
    Prepared decision
    Check route, links and redirect before deciding on removal.
  3. Read the build chain

    Fictional candidate
    Generation tool not served to browsers
    Evidence or dependency
    A rebuild command consumes it
    Prepared decision
    Keep required sources; specify the published package.
  4. Separate test traces

    Fictional candidate
    DEMO test screenshot
    Evidence or dependency
    Identified artifact within temporary scope
    Prepared decision
    Prepare removal from the package after useful retention and path verification.

Which candidate can be declared disposable based only on its name?

Open each proposition to compare its diagnosis. More checks may still be needed.

The CSS without an exact textual reference

No. Its name is dynamically constructed. Test variants and trace the constructor.

The tool absent from every page

No. A build tool may be needed without ever being served to visitors.

None: establish uses, scope and recovery

Yes. Identifying an artifact prepares a decision; it does not authorize indiscriminate deletion.

Fictional decision record

Scope: DEMO public package, not every file
Dynamic CSS: use confirmed, retained
Old URL: examine index and sitemap
Tool: consumed by rebuild, retained
Test screenshot: candidate for exclusion from package
Executed action: no deletion

Git status helps inventory version tracking. It alone does not show whether a file is served, used in maintenance or retained in another archive.

Documentation of the rules, separate from fictional examples

Compare other situations and exercises

A font appears abandoned

The replacement icon system no longer uses a font. Check every loaded stylesheet, pseudo-element and menu state. Remove the old library only once its functions have been replaced and the affected checks pass.

A photograph has four sizes

The small variant has no exact PHP reference, but a manifest supplies it to the browser. Read the manifest and inspect currentSrc at relevant widths. Keep used variants; failure to select one in a single screenshot is not evidence that it is unnecessary.

Screenshots sit beside content

Reports, captures and measurement files support testing work. Remove them from the published project after retaining needed evidence elsewhere. Keep photographic credits and editorial data displayed to readers.

No page loads the licence file

Illustrative case: a font remains distributed with the site, but a reference search marks its licence text unused. That text documents reuse terms. Keep the required information with the font or distribution package; lack of browser loading does not justify removal.

An old export still feeds a task

Fictional example: an export absent from menus generates an index each week. Examine the command and actual path before removal. When replacing that use, update producer and consumer and rerun generation; checking only current pages can miss a delayed failure.

Worked exercise

A file absent from HTML still feeds the build

Fictional example: the values and documents teach the method and do not describe a real organisation.

source.csv appears in no rendered page. The current index works; the monthly script still reads this source to build the next index.

If the table exceeds the screen, scroll horizontally; arrow keys work when the region is focused.

Starting information
ObjectReference typeNext step in the chain
source.csvGenerator inputMonthly script
Monthly scriptScheduled processingindex.json
index.jsonGenerated outputSite search

Your checks

  1. Read the generation command and inputs.
  2. Map source → generator → output → page.
  3. Test the next generation on a copy.
Read the answer

Answer and decision

The file has delayed use: the site can work until the next build. Removing it would break generation. Retain it or explicitly replace its producer and consumer before removal; an HTML search does not cover this dependency.

If the case changes

If a new source truly replaces source.csv, check generated output and restoration before marking the old file removable.

Record to retain

Keep dependency graph, command, generation result and retention decision.

Record to retain

  • Candidate inventory: path, size, role and removal reason.
  • Direct and dynamic dependencies inspected, with covered routes and languages.
  • Recoverable version, storage location and exact removed-file list.
  • Before-and-after results, any missing resources and actual removed volume.
  • Producers, consumers, usage frequency and licences for retained resources.

Official references

Related protocols

Checks before reaching a conclusion

  • Is lack of use established in code, rendered pages and dynamically built paths, rather than just a filename search?
  • Are responsive variants, preloads, sharing images and sitemap declarations considered before removing media?
  • Does removal preserve data used by search, translations and recovery functions while leaving access information untouched?
  • Do generation and maintenance still work after removing only proven candidates?

Frequently asked questions

Can everything absent from the sitemap be removed?

No. A sitemap describes URLs; it does not list the includes, data, media or operations needed to serve them.

Does gitignore prevent publication?

Not necessarily. Git ignore concerns tracking untracked files. Deployment rules determine what gets published.

Should original photographs be kept?

Retain a quality source and licensing information when future variants may be needed. They can live outside the public directory while the website serves optimized files.

Does cleanup automatically improve performance?

It reduces storage and may simplify delivery. Page loading improves when transferred resources, processing or executed dependencies actually decrease.

When to keep an old file?

When documenting a version, it remains necessary for a journey or serves for a recovery. Its conservation must have an explicit role and not make the current reference ambiguous.

DEEPER READING / PRACTICE

Remove files without breaking dependencies

A project contains old images, scripts and test pages. Before deleting an item, you need to determine whether it is still used directly or referred by a configuration.

Updated on .

Priority checks

Search for references in pages, style sheets, scripts and data. Examine public URLs, indirect dependencies and files required for a restoration.

Interpretation pitfalls

The absence in a text search does not always demonstrate the inutility of a dynamically charged file. A mass removal can also remove a document still linked to the outside.

Working record to retain

The removal inventory specifies the file, searched references, decision and recovery method. After cleaning control covers the pages and interactions that used the relevant elements.