Skip to main content
https://img.shields.io/github/workflow/status/soxofaan/CssDeadwood/Lint%20and%20Test https://img.shields.io/github/license/soxofaan/CssDeadwood

CSS Deadwood is a tool to search for unused CSS selectors by scanning given CSS files for CSS selectors and matching these against HTML files (and optionally PHP/Python/Ruby/templates source code).

Installation

The easiest way to install CSS Deadwood is with pip:

pip install cssdeadwood

or easy_install:

easy_install cssdeadwood

These will install (among others) the cssdeadwood script in a bin folder corresponding with the used installation procedure.

Note that CSS Deadwood depends on lxml, which may take a while to install/compile if it is not available on your system already.

Development

Or, if you want to go for the development version, clone CSS Deadwood from https://github.com/soxofaan/CssDeadwood/

Usage

Basic usage of the cssdeadwood tool is pretty simple: just provide pass it one or more CSS files and one or more HTML files and let it do its job:

cssdeadwood style.css index.html

For example, CSS Deadwood comes with a demo mode:

cssdeadwood --example

--------------------------------------------------------------------------------
Running CSS Deadwood in example mode with following CSS and HTML file as input:
/path/to/cssdeadwood/test/files/css/css001.css
/path/to/cssdeadwood/test/files/html/html001.html
--------------------------------------------------------------------------------

INFO:cssdeadwood:Working with 1 CSS files.
INFO:cssdeadwood:Working with 1 HTML files.
INFO:cssdeadwood:Working with 0 source files.
INFO:cssdeadwood:Analysing CSS selectors from '/path/to/cssdeadwood/test/files/css/css001.css'
INFO:cssdeadwood:Extracted 5 CSS selectors from '/path/to/cssdeadwood/test/files/css/css001.css'.
INFO:cssdeadwood:DOM matching 5 CSS selectors: 3 matches, 2 unmatched with DOM from '/path/to/cssdeadwood/test/files/html/html001.html'
/path/to/cssdeadwood/test/files/css/css001.css
Could not determine usage of the following 2 CSS selectors (from 5 in total: 40.0%):
#content div.ad
a.premium

Metadata

Release files for CssDeadwood 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for CssDeadwood 0.3.0
File Interpreter ABI Platform
CssDeadwood-0.3.0-py3-none-any.whl Python 3 none any Details

Release files / CssDeadwood-0.3.0-py3-none-any.whl

Download URL CssDeadwood-0.3.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91848c7a69dcaaa2f061a4875eb9ef6a29b31ab39da849afc7c137f59a6757f9
BLAKE2b-256 checksum
How to use checksums
8dcfb00474b80dc82af4588fe2884629b3557b259f5b61ff86ec9d7c6f179d36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.3

Security for CssDeadwood 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page