Git Product home page Git Product logo

jekyll-tailwindcss-boilerplate's Introduction

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 ๐Ÿ™‚

jekyll-tailwindcss-boilerplate's People

Contributors

dependabot[bot] avatar kangabru avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.