Code Monkey home page Code Monkey logo

11ty-tailwind's Introduction

Steps

  • git init
  • Add a .gitignore for _sites/ and node_modules/
  • npm init -y
  • npm install --save-dev @11ty/eleventy
  • Add a simple .eleventy.js config file
  • Add a simple index.html page
  • npm install --save-dev tailwindcss@latest postcss@latest postcss-cli@latest autoprefixer@latest
  • npx tailwindcss init --package
  • Add a tailwind.css with @tailwind entries
  • Add mode and purge to tailwind.config.js
  • Add scripts to package.json
    • "build": "rm -rf ./_site && npm run build:eleventy & npm run build:tailwind",
    • "build:eleventy": "npx @11ty/eleventy",
    • "build:tailwind": "TAILWIND_MODE=build NODE_ENV=production postcss ./tailwind.css --output ./_site/default.css",
    • "dev": "rm -rf ./_site && npm run dev:eleventy & npm run dev:tailwind",
    • "dev:eleventy": "npx @11ty/eleventy --serve",
    • "dev:tailwind": "TAILWIND_MODE=watch NODE_ENV=development postcss ./tailwind.css --output ./_site/default.css --watch"
  • npm run dev
    • Builds a minimal Tailwind CSS file and saves it to ./_site/default.css
  • Add the class text-red-200 to the body in index.html and save.
    • The class text-red-200 is added to the CSS, saved to ./_site/default.css and the browser refreshes.
  • Changed the class of the body from text-red-200 to text-green-200 in index.html and save
    • The class text-green-200 is added to the CSS and saved to ./_site/default.css but the class text-red-200 is not removed and the browser refreshes.
  • Add h1 { @apply text-7xl font-bold; } to tailwind.css
    • The class h1 is added to the CSS and saved to ./_site/default.css but the browser does not refresh. This is expected as the changes to tailwind.css and the generated ./_site/default.css file are not being watched by Eleventy. A manual browser refresh will show the change.

11ty-tailwind's People

Contributors

richardherbert avatar

Stargazers

 avatar

Watchers

 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.