Skip to content

Instantly share code, notes, and snippets.

@stungeye
Created February 4, 2022 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stungeye/da23f4ca7a256649a26082ce0f738d1f to your computer and use it in GitHub Desktop.
Save stungeye/da23f4ca7a256649a26082ce0f738d1f to your computer and use it in GitHub Desktop.
Getting Started with Eleventy using WSL 2

Getting Started with Eleventy using WSL 2

  1. Install WSL and enable WSL2.
  2. Ensure everything is up to date from the WSL prompt:
    sudo apt update 
    sudo apt upgrade
    sudo apt install build-essential
    
  3. Install Node: curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash
  4. Navigate to your home folder: cd ~
  5. Create a folder for your first Eleventy site: mkdir eleventy-site
  6. Navigate to this new folder: cd eleventy-site
  7. Use configure this folder for use with npm: npm init -y
  8. Use npm to install Eleventy into this folder: npm install --save-dev @11ty/eleventy
  9. Set the folder as a git repo: git init .
  10. Have git ignore certain files: touch .gitignore
  11. Edit the .gitignore file: code .gitignore
  12. Add the following lines to the .gitignore file and save it:
    _site
    node_modules
    
  13. Create your first 11ty template: echo '<!doctype html><html><head><title>Page title</title></head><body><p>Hi</p></body></html>' > index.html
  14. Save everything to git:
    git add .
    git commit -m 'Initial commit'
    
  15. Fire up the 11ty live server: npx @11ty/eleventy --serve
  16. View your new website: http://localhost:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment