Skip to content

Commit

Permalink
Switch to jekyll-vite
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesrussell committed Jun 29, 2024
1 parent fccf525 commit ad8a5a2
Show file tree
Hide file tree
Showing 25 changed files with 482 additions and 278 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ assets/js/
assets/css/
/lib
moveViteFiles.cjs

# Vite Ruby
/public/vite*
node_modules
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local

1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ gem "minima", "~> 2.5"
# Use dotenv for environment variables
gem "dotenv"

# Jekyll plugins (commented out for now)
gem "jekyll-vite"

# Jekyll plugins
group :jekyll_plugins do
gem 'jekyll-paginate'
gem 'kramdown-parser-gfm'
Expand Down
47 changes: 47 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ GEM
colorator (1.1.0)
concurrent-ruby (1.3.3)
dotenv (3.1.2)
dry-cli (1.0.0)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
Expand Down Expand Up @@ -67,6 +68,10 @@ GEM
sass-embedded (~> 1.54)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-vite (3.0.4)
jekyll (>= 3, < 5)
rackup (~> 0.2)
vite_ruby (~> 3.2)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.4.0)
Expand All @@ -85,6 +90,12 @@ GEM
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (6.0.0)
rack (3.1.4)
rack-proxy (0.7.7)
rack
rackup (0.2.3)
rack (>= 3.0.0.beta1)
webrick
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
Expand All @@ -96,23 +107,58 @@ GEM
sass-embedded (1.77.5)
google-protobuf (>= 3.25, < 5.0)
rake (>= 13)
sass-embedded (1.77.5-aarch64-linux-android)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-aarch64-linux-gnu)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-aarch64-linux-musl)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-aarch64-mingw-ucrt)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-arm-linux-androideabi)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-arm-linux-gnueabihf)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-arm-linux-musleabihf)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-arm64-darwin)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-riscv64-linux-android)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-riscv64-linux-gnu)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-riscv64-linux-musl)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86-cygwin)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86-linux-android)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86-linux-gnu)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86-linux-musl)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86-mingw-ucrt)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86_64-cygwin)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86_64-darwin)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86_64-linux-android)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86_64-linux-gnu)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.5-x86_64-linux-musl)
google-protobuf (>= 3.25, < 5.0)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.5.0)
vite_ruby (3.6.0)
dry-cli (>= 0.7, < 2)
rack-proxy (~> 0.6, >= 0.6.1)
zeitwerk (~> 2.2)
webrick (1.8.1)
zeitwerk (2.6.16)

PLATFORMS
aarch64-linux
Expand Down Expand Up @@ -148,6 +194,7 @@ DEPENDENCIES
jekyll-feed
jekyll-paginate
jekyll-seo-tag
jekyll-vite
kramdown-parser-gfm
minima (~> 2.5)

Expand Down
3 changes: 3 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

vite: bin/vite dev
jekyll: bin/jekyll-vite wait && bundle exec jekyll serve --livereload
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

require 'jekyll/vite'
ViteRuby.install_tasks

8 changes: 7 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ style: dark
listen_for_clients_preferred_style: true
footer: 'follow me on <a href="https://twitter.com/jonesrussell42">twitter</a>'
theme: minima
destination: _site/jekyll
# destination: _site/jekyll
tags:
- web-development
- php
Expand All @@ -19,10 +19,16 @@ header_pages:
- index.markdown
- about.markdown
plugins:
- jekyll/vite
- jekyll-feed
- jekyll-seo-tag
- jekyll-paginate
exclude:
- bin
- config
- vite.config.ts
- tmp
- Procfile.dev
- .sass-cache/
- .jekyll-cache/
- gemfiles/
Expand Down
8 changes: 8 additions & 0 deletions _frontend/entrypoints/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "@fortawesome/fontawesome-free/js/all.js";
import '~/_sass/app.scss'

// To see this message, follow the instructions for your Ruby framework.
//
// When using a plain API, perhaps it's better to generate an HTML entrypoint
// and link to the scripts and stylesheets, and let Vite transform it.
console.log('Vite ⚡️ Ruby')
3 changes: 3 additions & 0 deletions _includes/custom-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

{% vite_client_tag %}
{% vite_typescript_tag application %}
6 changes: 5 additions & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@

<title>{{ title }}</title>

{% if environment == 'production' %}
{% include google.html %}
</head>
{% endif %}

{% include custom-head.html %}
</head>
20 changes: 20 additions & 0 deletions _layouts/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">

{%- include head.html -%}

<body>

{%- include header.html -%}

<main class="page-content" aria-label="Content">
<div class="wrapper">
{{ content }}
</div>
</main>

{%- include footer.html -%}

</body>

</html>
15 changes: 0 additions & 15 deletions _layouts/default.html

This file was deleted.

138 changes: 55 additions & 83 deletions _layouts/home.html
Original file line number Diff line number Diff line change
@@ -1,89 +1,61 @@
---
layout: default
layout: base
---
<div id="home">
<!-- Responsive Header -->
<section id="header-nav">
{% include header.html %}
</section>
<section id="header-content">
<h1>{{ site.theme_settings.title }}</h1>
</section>
<section class="bg"></section>
<div class="row">
<!-- Aside Navigation -->
<aside id="aside" class="col-md-4">
{% include aside.html %}
</aside>
<!-- Post List -->
<main id="posts" class="col-md-8">
{% for post in paginator.posts %}
<div class="post">
<div class="post-wrap">
<div class="text-warp">
<h3 class="title"><a href="{{ post.url }}">{{ post.title }}</a></h3>
<p class="excerpt">
{% if post.excerpt.size > 50 %}
{{ post.excerpt | strip_html | strip_newlines | truncatewords: 25, '...' }}
{% else %}
{{ post.subtitle }}
{% endif %}
</p>
<div>
<span class="meta">
{{ post.date | date: "%B %-d, %Y" }}
</span>
<ul class="tag-wrap">
{% for tag in post.tags %}
<li class="tag-sm"><a href="{{site.baseurl}}/tags#{{ tag | cgi_escape }}">{{ tag }}</a></li>
{% endfor %}
</ul>
</div>
</div>
{% if post.image %}
<div class="img-wrap">
<img src="{{ post.image }}" alt="">
</div>
{% endif %}
</div>
</div>
{% endfor %}
<!-- Pagination -->
{% if paginator.total_pages > 1 %}
<div id="pagination">
<ul>
{% assign q = paginator.page | divided_by: 5 %}
{% assign min = q | times: 5 %}
{% assign max = q | plus: 1 | times: 5 | minus: 1 %}
{% if min == 0 %}
{% assign min = 1 %}
{% endif %}
{% if max > paginator.total_pages %}
{% assign max = paginator.total_pages %}
{% endif %}
{% if min != 1 %}
<a href="/blog/page{{ min | minus: 1 }}">
<li class="btn-rounded prev">
<i class="fas fa-angle-double-left"></i>
</li>
</a>
{% endif %}
{% for page in (min..max) %}
<a href="{% if page == 1 %}/{% else %}/blog/page{{ page }}{% endif %}"
class="{% if page == paginator.page %}selected{% endif %}">
<li class="btn-rounded">{{ page }}</li>
</a>
{% endfor %}
{% if max != paginator.total_pages %}
<a href="/blog/page{{ max | plus: 1 }}">
<li class="btn-rounded next">
<i class="fas fa-angle-double-right"></i>
</li>

<div class="home">
{%- if page.title -%}
<h1 class="page-heading">{{ page.title }}</h1>
{%- endif -%}

{{ content }}


{% if site.paginate %}
{% assign posts = paginator.posts %}
{% else %}
{% assign posts = site.posts %}
{% endif %}


{%- if posts.size > 0 -%}
{%- if page.list_title -%}
<h2 class="post-list-heading">{{ page.list_title }}</h2>
{%- endif -%}
<ul class="post-list">
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
{%- for post in posts -%}
<li>
<span class="post-meta">{{ post.date | date: date_format }}</span>
<h3>
<a class="post-link" href="{{ post.url | relative_url }}">
{{ post.title | escape }}
</a>
{% endif %}
</h3>
{%- if site.show_excerpts -%}
{{ post.excerpt }}
{%- endif -%}
</li>
{%- endfor -%}
</ul>

{% if site.paginate %}
<div class="pager">
<ul class="pagination">
{%- if paginator.previous_page %}
<li><a href="{{ paginator.previous_page_path | relative_url }}" class="previous-page">{{ paginator.previous_page }}</a></li>
{%- else %}
<li><div class="pager-edge"></div></li>
{%- endif %}
<li><div class="current-page">{{ paginator.page }}</div></li>
{%- if paginator.next_page %}
<li><a href="{{ paginator.next_page_path | relative_url }}" class="next-page">{{ paginator.next_page }}</a></li>
{%- else %}
<li><div class="pager-edge"></div></li>
{%- endif %}
</ul>
</div>
{% endif %}
</main>
</div>
{%- endif %}

{%- endif -%}

</div>
15 changes: 12 additions & 3 deletions _layouts/page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
---
layout: default
layout: base
---
{% include header.html %}
{{ content }}
<article class="post">

<header class="post-header">
<h1 class="post-title">{{ page.title | escape }}</h1>
</header>

<div class="post-content">
{{ content }}
</div>

</article>
Loading

0 comments on commit ad8a5a2

Please sign in to comment.