leeoniya / dropcss

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

allow amp ⚡ #48

Closed godofdream closed 4 years ago

godofdream commented 4 years ago

Currently dropcss fails on amp html documents because of the "⚡" attribute in the html element. This pull requests adds "⚡" as an attribute

leeoniya commented 4 years ago

hi @godofdream, thanks for the PR.

unfortunately i will not accept this change because i am fundamentally against what Google is doing to the open web by shoving AMP down everyone's throats while falsely claiming it's for performance.

you will have to strip the stupid lightning char if you want to use dropcss with amp documents.

godofdream commented 4 years ago

for the future: if someone stumbles over this problem you can replace the <html ⚡> tag with an <html amp> tag without needing to edit dropcss.

My usecase: Dropcss helps me to reduce the bloatet bootstrap4 css to fit it for amp.

offtopic: you can like or hate amp. Amp profits from google caches and is therefore nice in some mobile google search result cases. Also it provides lightweight image sliders and carousels. With server-side-prerendering amp is actually fast, however I would have preferred amp with No-js.

Thank you for the project 👍

leeoniya commented 4 years ago

yes, amp does benefit from google cache and the fact that your bowser doesnt need to establish a dedicated TLS connection to each domain when you're coming from a google results page. i'm very well aware of what parts of amp are benficial and cannot be done without big G, and which parts google enforces for its own control of the web. i know a lot of typical users enjoy amp, and i also know a lot of people who will install 1000 different android apps and click through any and all permission prompts without understanding and/or caring about the implications. the same crowd loved AOL's keywords back in the day as being the gateway to their content.

however I would have preferred amp with No-js.

yes, amp runs an absurd amount of JS even for pages which themselves need 0 js. (at least last time i checked).

anyways, glad dropcss is working well for you.

ghostdevv commented 1 year ago

I'd ask you to revisit this @leeoniya - I 100% agree that amp sucks, but the error message is unhelpful and makes it harder to get started with this package in the rare case you are using amp. I've had to add a .replace('⚡', 'amp') in the SvelteKit docs so hopefully no one runs into this problem - alternatively a nice error message with a link here would be awesome :pray: