# How prevalent are empty custom properties in CSS?

**URL:** <https://discuss.httparchive.org/t/how-prevalent-are-empty-custom-properties-in-css/2153>\
**Category:** Analysis\
**Created:** [May 27, 2021, 3:58pm UTC](https://discuss.httparchive.org/t/how-prevalent-are-empty-custom-properties-in-css/2153 "2021-05-27T15:58:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rviscomi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/rviscomi/32/835_2.png) [@rviscomi](https://discuss.httparchive.org/u/rviscomi)\
**Post date:** [June 3, 2021, 7:12pm UTC](https://discuss.httparchive.org/t/how-prevalent-are-empty-custom-properties-in-css/2153/2 "2021-06-03T19:12:38Z")

</div>

While we wait for newer data to become available, I took a look at the 2020 data to get a preview of where we’re at.

I based this off of the [all\_properties.sql](https://github.com/HTTPArchive/almanac.httparchive.org/blob/main/sql/2020/css/all_properties.sql) query used by the 2020 Web Almanac’s CSS chapter:

```sql
#standardSQL
CREATE TEMPORARY FUNCTION getProperties(css STRING) RETURNS ARRAY<STRING> LANGUAGE js AS '''
try {
	function compute(ast) {
		let ret = {};
		walkDeclarations(ast, ({property, value}) => {
      if (property == '--') {
        incrementByKey(ret, property);
      }
		});
		return ret;
	}
	let ast = JSON.parse(css);
	let props = compute(ast);
	return Object.entries(props).flatMap(([prop, freq]) => {
		return Array(freq).fill(prop);
	});
}
catch (e) {
	return [];
}
'''
OPTIONS (library="gs://httparchive/lib/css-utils.js");
SELECT
  *
FROM (
  SELECT
    client,
    prop,
    ARRAY_AGG(DISTINCT page) pages,
    COUNT(DISTINCT page) AS num_pages,
    COUNT(0) AS freq,
    SUM(COUNT(0)) OVER (PARTITION BY client) AS total,
    COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct
  FROM
    `httparchive.almanac.parsed_css`,
    UNNEST(getProperties(css)) AS prop
  WHERE
    date = '2020-08-01'
  GROUP BY
    client,
    prop)
ORDER BY
  pct DESC

```

The results show that the empty custom property is only used on 4 pages a total of 17 times, in the desktop and mobile datasets equally:

```sql
https://conquistaimoveisbrasil.com.br/
https://marcioluizcorretor.com.br/
https://unitedbyblue.com/
https://www.yumekoubou.or.jp/

```

So to answer the top question, it’s not very prevalent at all! It would be interesting to see if there are any major differences in the 2021 data, which I hope to have in a month or two.

---

_[View the full topic](https://discuss.httparchive.org/t/how-prevalent-are-empty-custom-properties-in-css/2153)._
