leeoniya / dropcss

An exceptionally fast, thorough and tiny unused-CSS cleaner
MIT License
2.13k stars 68 forks source link

Cannot read property '1' of null #61

Closed benmccann closed 2 years ago

benmccann commented 2 years ago

It's failing for me when I tried to run it. Details below

HTML

<!DOCTYPE html>
<html ⚡ lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="canonical" href="https://example.com" />

    <style amp-custom data-sveltekit></style>

    <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
    <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js">
    <script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
    <body>

<p data-source="load">http://localhost:3000</p>
<p data-source="store">http://localhost:3000</p>
<p data-source="endpoint">http://localhost:3000</p>
<footer class="s-PoaHcXV6SIWL">footer</footer>

    </body>
</html>

CSS

footer.s-PoaHcXV6SIWL{color:purple}.s-PoaHcXV6SIWL{}

Stack trace

<pre>TypeError: Cannot read property &#39;1&#39; of null
    at next (node_modules/.pnpm/dropcss@1.0.16/node_modules/dropcss/dist/dropcss.cjs.js:70:28)
    at tokenize (node_modules/.pnpm/dropcss@1.0.16/node_modules/dropcss/dist/dropcss.cjs.js:87:3)
    at _export_parse_ (node_modules/.pnpm/dropcss@1.0.16/node_modules/dropcss/dist/dropcss.cjs.js:195:15)
    at Proxy.dropcss (node_modules/.pnpm/dropcss@1.0.16/node_modules/dropcss/dist/dropcss.cjs.js:969:10)
leeoniya commented 2 years ago

hey @benmccann sorry just noticed this.

see my response and workaround in https://github.com/leeoniya/dropcss/pull/48