I'm using Jekyll and setting a cookie as a check whether to serve critical and async loaded CSS to the user so only first time visitors get the critical and async CSS. I'm using Filament Groups Enhance.js which sets the cookie and takes care of loading the CSS async. What I'm trying to do is check whether the cookie exists using Jekyll Liquid but not having much luck, in my main layout I have code like this:
{% if cookie.name == fullcss %}
<link rel="stylesheet" href="/css/style.css">
{% elsif page.section == 1 %}
<style>
{% include critical-css/getting-started.css %}
</style>
<script>
{% include js/enhance.js %}
</script>
<noscript>
<link rel="stylesheet" href="/css/style.css">
</noscript>
{% elsif page.section == 1 %}
...
Basically this is the technique I'm trying to achieve: http://iamsteve.me/blog/entry/using-cookies-to-serve-critical-css-for-first-time-visits but I cannot use PHP as I'm on a Jekyll site hosted with GH Pages.