Skip to content

Commit

Permalink
Add Prettier linting (#56)
Browse files Browse the repository at this point in the history
* Add prettier. Format liquid files

* Update files ignored by prettier

* Auto-fix prettier violations

---------

Co-authored-by: Sheldon Bachstein <[email protected]>
  • Loading branch information
Sheldon Bachstein and Sheldon Bachstein authored Dec 21, 2023
1 parent e42b8aa commit 475dcdf
Show file tree
Hide file tree
Showing 21 changed files with 982 additions and 586 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_site/
.DS_Store
node_modules/
17 changes: 17 additions & 0 deletions .prettier.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"plugins": ["@shopify/prettier-plugin-liquid"],
"overrides": [
{
"files": "_includes/*.html",
"options": {
"parser": "liquid-html"
}
},
{
"files": "_layouts/*.html",
"options": {
"parser": "liquid-html"
}
}
]
}
19 changes: 19 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Ignore build files
_site/

// Ignore minified js/css/etc bundles
assets/js/
**/*.min.css
**/*.min.js
css_new/uswds.css
js/analytics_lib.js
css/dataTables.bootstrap.css
js/galleria/galleria.js
js/dataTables.bootstrap.js
js/galleria/
js/html5shiv.js
js/jquery.*
js/uswds.js

// Ignore dependencies
node_modules/
30 changes: 13 additions & 17 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@
title: 404 Error
layout: default
permalink: /404.html

---
<div class="use-grid-wide" >
<div class="usa-width-one-half usa-offset-one-fourth usa-section">

<h1>Error &nbsp 4 :o 4</h1>
<div class="use-grid-wide">
<div class="usa-width-one-half usa-offset-one-fourth usa-section">
<h1>Error &nbsp 4 :o 4</h1>
<div id="page-error"></div>
</div>
</div>
</div>


<script>

function redirectToBlog() {
function redirectToBlog() {
var url = window.location.toString();
if (url.includes('blog')) {
url = `https://civictechdc.github.io/${url.slice(url.indexOf('blog'))}`;
document.getElementById('page-error')
.innerHTML = `<p>Hey, looks like this content has moved. Here is where you can find it: <a href='${url}'>${url}</a></p>`;
if (url.includes("blog")) {
url = `https://civictechdc.github.io/${url.slice(url.indexOf("blog"))}`;
document.getElementById("page-error").innerHTML =
`<p>Hey, looks like this content has moved. Here is where you can find it: <a href='${url}'>${url}</a></p>`;
} else {
document.getElementById('page-error')
.innerHTML = `<p>Hey, looks like this page doesn't exist</p>`;
document.getElementById("page-error").innerHTML =
`<p>Hey, looks like this page doesn't exist</p>`;
}
}

window.onload = redirectToBlog;
}

window.onload = redirectToBlog;
</script>
11 changes: 8 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ timezone: America/New_York
plugins:
- jekyll-redirect-from
future: true
baseurl: ''
baseurl: ""

collections:
- projects
sass:
sass_dir: _sass
style: compressed
exclude: ['sass/bootstrap/docs','sass/bootstrap/docs/index.html', 'sass/bootstrap/index.html']
include: ['sass/bootstrap/scss']
exclude:
[
"sass/bootstrap/docs",
"sass/bootstrap/docs/index.html",
"sass/bootstrap/index.html",
]
include: ["sass/bootstrap/scss"]
13 changes: 8 additions & 5 deletions _includes/project-card.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{% assign project_slug = include.project_slug %}
{% assign project = site.projects | where: "slug", project_slug | first %}
{% assign project_slug = include.project_slug %} {% assign project =
site.projects | where: "slug", project_slug | first %}

<script>
// console.log("{{ project_name }}");
// console.log("{{ project }}"); -->
</script>

<div class="usa-width-one-third">
<a href="{{ project.link }}" target="_blank"><img src="{{ site.baseurl }}/images/project_thumbnails/{{ project.image }}"></a>
<h3>{{ project.project_name }}</h3>
<p>{{ project.content }}</p>
<a href="{{ project.link }}" target="_blank"
><img
src="{{ site.baseurl }}/images/project_thumbnails/{{ project.image }}"
/></a>
<h3>{{ project.project_name }}</h3>
<p>{{ project.content }}</p>
</div>
30 changes: 18 additions & 12 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<title>
Expand Down Expand Up @@ -157,9 +157,7 @@
</div>
</header>

<div class="container content">
{{content}}
</div>
<div class="container content">{{content}}</div>
<!-- /container -->
<footer class="usa-footer usa-footer-slim" role="contentinfo">
<!-- <div class="usa-footer-primary-section">
Expand Down Expand Up @@ -205,7 +203,9 @@ <h3 class="usa-footer-slim-logo-heading">Civic Tech DC</h3>
</div>
<div class="usa-width-one-third">
<p>
<a href="https://github.com/civictechdc" target="_blank">GitHub</a>
<a href="https://github.com/civictechdc" target="_blank"
>GitHub</a
>
</p>
<p>
<a href="https://www.linkedin.com/company/civic-tech-dc/" target="_blank"
Expand All @@ -214,8 +214,14 @@ <h3 class="usa-footer-slim-logo-heading">Civic Tech DC</h3>
</p>
</div>
<div class="usa-width-one-third">
<p><a href="https://forms.gle/xNkayfBVMJj8dt1X8">Give Feedback</a></p>
<p><a href="https://forms.gle/HrpBe69qqCG8NiNo6">Become an Organizer</a></p>
<p>
<a href="https://forms.gle/xNkayfBVMJj8dt1X8">Give Feedback</a>
</p>
<p>
<a href="https://forms.gle/HrpBe69qqCG8NiNo6"
>Become an Organizer</a
>
</p>
</div>
</div>
</div>
Expand All @@ -242,16 +248,16 @@ <h3 class="usa-footer-slim-logo-heading">Civic Tech DC</h3>
const returnToTop = () => {
const scrollTop = $(window).scrollTop();
if (scrollTop > showReturnToTopThreshold) {
$('#returnToTop').show();
$("#returnToTop").show();
} else {
$('#returnToTop').hide();
$("#returnToTop").hide();
}
};

$(window).on('scroll', () => returnToTop());
$('#returnToTopLink').click(e => {
$(window).on("scroll", () => returnToTop());
$("#returnToTopLink").click((e) => {
e.preventDefault();
$('html,body').animate(
$("html,body").animate(
{
scrollTop: 0,
},
Expand Down
4 changes: 1 addition & 3 deletions _layouts/narrow.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
---

<div class="usa-grid">
<div class="usa-width-two-thirds usa-section">
{{ content }}
</div>
<div class="usa-width-two-thirds usa-section">{{ content }}</div>
</div>
31 changes: 15 additions & 16 deletions _layouts/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,49 @@

<p><img alt="{{page.title}}" class="img-thumbnail" src="{{page.image}}" /></p>

<p><a href='/projects.html'>&laquo; back to Projects &amp; successes</a></p>
<p><a href="/projects.html">&laquo; back to Projects &amp; successes</a></p>

<h2>{{ page.title }}</h2>
{% if page.website %}
<p><i class='fa fa-globe'></i> <a target='_blank' href='{{page.website}}'>{{page.website}}</a></p>
<p>
<i class="fa fa-globe"></i>
<a target="_blank" href="{{page.website}}">{{page.website}}</a>
</p>
{% endif %}

<div class='post'>
{{ page.description | markdownify }}
</div>
<div class="post">{{ page.description | markdownify }}</div>

<div class="row post">
<div class="col-sm-7">
{{ content }}
</div>
<div class="col-sm-7">{{ content }}</div>
<div class="col-sm-5">
<div class="well">
<table class='table table-condensed'>
<table class="table table-condensed">
<tbody>
{% if page.website %}
<tr>
<td>Website</td>
<td><a target='_blank' href='{{page.website}}'>{{page.title}}</a></td>
<td>
<a target="_blank" href="{{page.website}}">{{page.title}}</a>
</td>
</tr>
{% endif %}
<tr>
<td>Tags</td>
<td>
{% for tag in page.tags %}
{{tag}}<br />
{% for tag in page.tags %} {{tag}}<br />
{% endfor %}
</td>
</tr>
<tr>
<td>Creators</td>
<td>
{% for creator in page.creators %}
{{creator}}<br />
{% for creator in page.creators %} {{creator}}<br />
{% endfor %}
</td>
</tr>
<tr>
<td>GitHub</td>
<td><a href='{{page.github}}'>{{page.github}}</a></td>
<td><a href="{{page.github}}">{{page.github}}</a></td>
</tr>
<tr>
<td>Launched</td>
Expand All @@ -57,4 +56,4 @@ <h2>{{ page.title }}</h2>
</table>
</div>
</div>
</div>
</div>
Loading

0 comments on commit 475dcdf

Please sign in to comment.