A simpler starter for building Eleventy static sites with WebC and Tailwind CSS
-
Clone this repo:
git clone --depth 1 git@github.com:dulltackle/11ty-webc-tailwindcss-starter.git my-awesome-site
-
Change into the working directory:
cd my-awesome-site
-
Install dependencies:
npm install
-
Check if works properly:
- start the preview server:
npm run dev
- preview in the browser:
http://localhost:8080
- change page content and add Tailwind CSS utilities
If works properly, you'll see something like below in the terminal:
- start the preview server:
-
Clean template:
- delete template files like
src/_includes/webc/my-counter.webc
- update info files like
package.json
- ...
- clear template git repo history:
rm -rf .git
- delete template files like
-
Initialize and publish your own git repo
-
If ready, create a production build:
npm run build
For the sake of simplicity, there is no build tool like Webpack. So Tailwind CSS actually runs in parallel with Eleventy, which may causes some problems during development:
- developer adds tailwind utilities to the page(
src/index.webc
for example) - the rebuilding processes of Eleventy and Tailwind CSS are both triggered
- the page in the preview changes accordingly
Actually, the rebuilding process of Eleventy is triggered twice:
- developer changes
src/index.webc
- Tailwind CSS changes
src/style.css
Most of the time, the page in the preview shows the version with the latest CSS file generated by Tailwind CSS. If it fails, JUST PRESS F5 until a more elegant approach emerges 😜
- create preview site
- add navigation template
- add posts template
- add data file template
- support static file
- support date
MIT License © 2023-Present dulltackle