new_site/_includes
George 64cf57fab3
Added support to PurgeCSS (#1562)
Tackled #1329 with [PurgeCSS](https://purgecss.com/).

Being talking with @varuniyer about using
[jekyll-uncss](https://github.com/episource/jekyll-uncss) to reduce css
file sizes by ditching unused classes. This approach have 3 main
problems:

1 - have some limitations as pointed
[here](https://github.com/alshedivat/al-folio/issues/1329#issuecomment-1546517327)
2 - last update to
[jekyll-uncss](https://github.com/episource/jekyll-uncss) was about 3
years ago, so it might have a few issues
3 - [uncss](https://github.com/uncss/uncss) haven't seem a new release
in a while, currently [lacking
maintenance](https://github.com/uncss/uncss/issues/459), and using some
deprecated libraries as seem here:

```
npm install -g uncss
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
```

I thought about giving PurgeCSS a go, since it has been more [actively
maintaned](https://github.com/FullHuman/purgecss), but
[jekyll-purgecss](https://github.com/mhanberg/jekyll-purgecss) haven't.

For this, I needed to change to use some local libraries instead of
getting them via CDN. The good news is that it is quite effective in
reducing css file sizes. Comparing dir sizes with `du -hs
_site/assets/css/`:

| current | minify | PurgeCSS | PurgeCSS + minify |
| ------- | ------ | -------- | ----------------- |
| 1,1M    | 988K   | 456K     | 420K              |

---------

Signed-off-by: George Araujo <george.gcac@gmail.com>
2023-09-28 14:22:42 -03:00
..
cv CV Restyled (#1339) 2023-07-11 22:53:53 -03:00
repository Added github 🏆 section in repositories (#1229) 2023-03-18 18:01:30 -04:00
resume Don't display badge if startDate is empty (#1682) 2023-08-28 18:13:01 -03:00
scripts Added support to PurgeCSS (#1562) 2023-09-28 14:22:42 -03:00
audio.html Cache busting for _sass and individual files (#1557) 2023-07-30 00:14:23 -03:00
disqus.html Add support for giscus comments (#1028) 2022-12-11 22:33:09 -05:00
figure.html Cache busting for _sass and individual files (#1557) 2023-07-30 00:14:23 -03:00
footer.html Better SEO, OpenGraph, schema.org and clean generated code (#481) 2021-12-31 11:46:42 -05:00
giscus.html Add support for giscus comments (#1028) 2022-12-11 22:33:09 -05:00
head.html Added support to PurgeCSS (#1562) 2023-09-28 14:22:42 -03:00
header.html Add a progress bar to show the scroll position (#934) 2022-10-24 15:08:26 +05:30
latest_posts.html Make latest post redirect if the blog post redirects (#1451) 2023-06-10 21:43:31 -04:00
metadata.html Added missing socials to metadata (#1575) 2023-07-17 16:35:33 -03:00
news.html Fixed news limit (#1359) 2023-04-27 12:26:48 -03:00
pagination.html Better SEO, OpenGraph, schema.org and clean generated code (#481) 2021-12-31 11:46:42 -05:00
projects.html Theme and responsiveness fixes (#509) 2022-02-19 20:46:45 -05:00
projects_horizontal.html fix #814 (#818) 2022-08-15 08:40:12 +05:30
related_posts.html Added related posts section (#1168) 2023-02-19 21:26:48 -05:00
selected_papers.html Fixed hard-coded bib files in templates (#1373) 2023-04-27 11:55:57 -03:00
social.html add WeChat to socials (#1730) 2023-09-17 15:49:27 -04:00
video.html Cache busting for _sass and individual files (#1557) 2023-07-30 00:14:23 -03:00