Skip to content

prashant3863/prashant3863.github.io

Repository files navigation

Jekyll & Tailwind CSS Boilerplate

A bare bones Jekyll site which comes preconfigured to use Tailwind CSS for styling.

👉 Try the demo here 👈

Netlify Status

Features

  • 🤍 Ships free of styling or theming. You can:
  • 📈 Ships Google Analytics and SEO ready
  • 🍕 Dev mode: your Jekyll site is refreshed on file changes and all Tailwind CSS classes are available for use.
  • 💻 Release mode: CSS is optimised by striping out unused classes and minifying the file.

👟 Install

Ensure Ruby and node (v12.13+) are installed then setup the project:

npm run setup

Configure Jekyll via _config.yml:

  • Add your site title and description
  • Add your google anlaytics ID
  • Add seo config via jekyll-seo-tag docs

🍕 Develop

npm start

Open your page on localhost:4000. Parcel and Jekyll will run concurrently so file changes update automatically.

⚠️ CSS might not render on the very first load. ⚠️

Simply open styles/index.css in your local text editor, save the file to trigger an update, wait until Parcel/Jekyll update, then refresh your browser.

Jekyll and Parcel run concurrently in dev builds so the CSS may not generate in time. This only happens once (when the file doesn't exist) and is not an issue in prod builds.

💻 Release

npm run build

Tailwind CSS is minified and Jekyll outputs the site to the _site folder.

Deploy on Netlify

Deploy statically (e.g. Netlify) with the following build settings:

  • Command: npm run build
  • Directory: _site

Packages

Here are the docs for packages used in this boilerplate:


🤔 FAQ

What is the tailwindcss-typography plugin and do I need it?
  • By default Tailwind normalises styles so headings, paragraphs, etc. look the same
  • But Jekyll is often used for blogs and other text heavy site where you often want default text styles
  • The typography plugin solves this and brings nice default styles to markdown generated content
  • It's completely optional and easy to activate for specific content via the prose classes
  • Note that it adds ~20kB to your final CSS file in prod. This isn't huge but is good to remove if you don't need it
  • To remove it simply delete it from the plugins section in your tailwind.config.js file
Why are CSS file changes slow to update?
  • When you update the index.css file all Tailwind classes have to regenerate (via Parcel) which can take up to ~10 secs
  • In practise this isn't a common problem as most people don't update the file that often
  • If you are writing custom CSS then you can add non-Tailwind CSS files and add refer to them in the head.html file directly which skips the Parcel build process
Styles don't load when I build then open index.html locally
  • CSS may not load if you open the _site/index.html file directly in you local browser
  • To see the final site run jekyll serve and open the local server url (localhost:4000)
  • This should not be a problem when deployed to a server
Some of my styles disappear when deployed
  • Jekyll markdown may generate elements that are being purged by Tailwind CSS. See these docs to whitelist elements or configure PurgeCSS further
  • Don't build up class names like "my" + "-class". Use full names like "my-class" instead
  • Don't whitelist the _site/ folder as this folder is not guaranteed to exist when deployed to a server

Have another issue?

Contact me by posting an issue. I'll be happy to help 🙂

About

repo for my website and blog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published