GithubHelp home page GithubHelp logo

jalletto / website Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 871.32 MB

Shell 0.97% JavaScript 31.99% Ruby 0.63% Python 0.65% Awk 0.23% CSS 0.34% HTML 25.95% Dockerfile 0.08% SCSS 38.29% Earthly 0.88%

website's Introduction

Earthly Website & Blog

How To Build in Earthly and Run in Docker

Run Blog in Docker

Build docker image for blog:

> earthly ./blog+run

Then browse to http://0.0.0.0:4002/blog/

Run Website in Docker

You can run the website locally, and use it to preview changes as you go.

> earthly ./website+run

Then browse to http://0.0.0.0:4001/

Alternative Run

By default the Earth files use a prebuilt image. To skip this and build the image yourself use --CACHE_IMAGE="NO"

> earthly ./blog+run --CACHE_IMAGE="NO"

Or

> earthly ./website+run --CACHE_IMAGE="NO"

To update the base image, makes changes in the earthfile and then run this workflow.

Linting

The blog has several linting steps. They run in CI, but you can also run them locally using earthly +blog-lint.

These linting errors can also be seen directly in VS Code if you install them natively (See Install Dependencies below ) and install vs-code extension markdownlint and vale.

Also the helper function lint exists which will correct some of the lint problems itself and return any it can't correct (see helper functions below).

Run Blog Native on MacOS

Volume mounts on a mac can be slow, until such time as watch mode exists it can be worth it to run Jekyll natively.

Install Dependencies

For blogging locally:

 brew update
 brew upgrade ruby-build
 brew install rbenv
 rbenv install 2.7.0
 rbenv global 2.7.0
 brew install vips
 brew install pandoc
 brew install dateutils 

Then, in /blog/ run bundle install.

For linting locally (and in vs code):

 brew install vale
 brew install markdownlint-cli
 brew install sponge
 brew install gawk
 brew install gnu-sed

gnu-sed works different than the version of sed that comes with mac by default, so you need to add the line below to your .bashrc or .zshrc to get your system to use it.

# For Intel Mac
 export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"

# For M1 Mac
export PATH=/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH

Helper Bash Functions

There are helper functions in util/functions. Once sourced, list lists them.

> source ./util/functions
functions assume they are run from repo root
run "list" for a list of helpers
> list
function             description
----------------     -----------------------------------------------------------------
clear-images()       Clear images for latest post
link-opp()           List places you could link to other posts
lint()               Run Linter
list-images
new-post()           Eg. new-post multi-word-slug
set-author-image()   Eg. set-author-image first-last.jpg
set-header()         Set latest-image as header using $IMAGE_DOWNLOADS
set-image()          Save latest-image using $IMAGE_DOWNLOADS
imgur(){             Download images from imgur from post and update post
start-blog(){        Start up blog on localhost:4002/blog
start-website(){     Start up website on localhost:4001
-----------------------------------------------------------------------------------------

Build Site (Blog and Website)

Build this site into a folder of static files:

earthly +build

Results will be output to build and future dated posts will not be included. To include future dated posts use:

earthly +dev-build

How To Deploy

Anything merged into main is deployed using earthly +build in GitHub actions.

FAQS

Question: A page is not updating - what did I do wrong? Answer: Clear the cache with earthly +clean

website's People

Contributors

adamgordonbell avatar alexcb avatar brandonsc avatar dchw avatar jalletto avatar mirho avatar vladaionescu 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.