Skip to content

Instantly share code, notes, and snippets.

View huphtur's full-sized avatar
👨‍🦲
He/Him/His

Marcel Appelman huphtur

👨‍🦲
He/Him/His
View GitHub Profile
@huphtur
huphtur / .eleventy.config.js
Created January 28, 2021 21:07 — forked from danielpost/.eleventy.config.js
Eleventy: Purge CSS for each html file
const { PurgeCSS } = require('purgecss');
/**
* Remove any CSS not used on the page and inline the remaining CSS in the
* <head>.
*
* @see {@link https://github.com/FullHuman/purgecss}
*/
eleventyConfig.addTransform('purge-and-inline-css', async (content, outputPath) => {
if (process.env.ELEVENTY_ENV !== 'production' || !outputPath.endsWith('.html')) {
@huphtur
huphtur / jekyll-header-with-social-meta.html
Last active December 31, 2015 20:17 — forked from ecarlisle/jekyll-header-with-social-meta.html
This is an optimized version of Jekyll's /_includes/head.html include. Liquid variables are created up top to keep the source DRY and clean. Included in this header are Open Graph and Twitter meta tags for social integration.
{% assign full_url = site.baseurl | prepend: site.url %}
{% capture page_title %}
{% if page.title %}
{{ page.title }}
{% else %}
{{ site.title }}
{% endif %}
{% endcapture %}
{% assign page_title = page_title | strip_newlines | split " " | join " " %}