Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const site = require('./src/_data/site.json');
const markdownLib = require('./src/utils/markdown-lib');

module.exports = function(config) {
config.setLibrary("md", markdownLib)
config.setLibrary('md', markdownLib);

// Filters
config.addFilter('dateFilter', dateFilter);
Expand Down Expand Up @@ -75,7 +75,6 @@ module.exports = function(config) {
.slice(0, site.maxPostsPerPage);
});


// Plugins
config.addPlugin(rssPlugin);
config.addPlugin(syntaxHighlight);
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/build-eleventy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build Eleventy

on: [push]

jobs:
build:
runs-on: ubuntu-20.04

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: |
npm ci

- name: lint
run: |
npm run lint

- name: build
run: |
npm run sass:process
env NODE_ENV=production npx @11ty/eleventy
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is a basic workflow to help you get started with Actions
name: Build Eleventy
name: Build Eleventy and Deploy

on:
push:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"scripts": {
"sass:tokens": "npx json-to-scss src/_data/tokens.json src/scss/_tokens.scss",
"sass:process": "npm run sass:tokens && sass src/scss/global.scss src/_includes/assets/css/global.css --style=compressed",
"lint": "prettier -c '**/*.js'",
"lint:fix": "prettier --write '**/*.js'",
"start": "concurrently \"npm run sass:process -- --watch\" \"npm run serve\"",
"serve": "cross-env ELEVENTY_ENV=development npx eleventy --serve",
"production": "npm run sass:process && npx eleventy"
Expand Down
2 changes: 1 addition & 1 deletion src/_includes/partials/global/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const EXCLUDED_URLS = [];
const PRE_CACHE_URLS = ['/', '/fonts/Whyte/Whyte-Bold.otf'];

// You might want to bypass a certain host
const IGNORED_HOSTS = ['localhost', 'unpkg.com', ];
const IGNORED_HOSTS = ['localhost', 'unpkg.com'];

/**
* Takes an array of strings and puts them in a named cache store
Expand Down
6 changes: 4 additions & 2 deletions src/filters/date-filter-ja.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = function dateFilterJa(value) {
const dateObject = new Date(value);

return `${dateObject.getFullYear()}-${("0" + (dateObject.getMonth() + 1)).slice(-2)}-${("0" + dateObject.getDate()).slice(-2)}`;
}
return `${dateObject.getFullYear()}-${('0' + (dateObject.getMonth() + 1)).slice(-2)}-${(
'0' + dateObject.getDate()
).slice(-2)}`;
};
15 changes: 14 additions & 1 deletion src/filters/date-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ const appendSuffix = n => {
module.exports = function dateFilter(value) {
const dateObject = new Date(value);

const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const months = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
];
const dayWithSuffix = appendSuffix(dateObject.getDate());

return `${dayWithSuffix} ${months[dateObject.getMonth()]}, ${dateObject.getFullYear()}`;
Expand Down
8 changes: 4 additions & 4 deletions src/filters/extract-excerpt-filter.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const striptags = require("striptags");
const striptags = require('striptags');

module.exports = function extractExcerptFilter(value) {
let excerpt = null;

excerpt = striptags(value)
.substring(0, 200) // Cap at 200 characters
.replace(/^\\s+|\\s+$|\\s+(?=\\s)/g, "")
.replace(/^\\s+|\\s+$|\\s+(?=\\s)/g, '')
.trim()
.concat("...");
.concat('...');
return excerpt;
}
};
2 changes: 1 addition & 1 deletion src/filters/lang-en-item-filter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = function enItemFilter(items) {
return items.filter(item => item.data.locale !== 'ja')
return items.filter(item => item.data.locale !== 'ja');
};
2 changes: 1 addition & 1 deletion src/filters/lang-ja-item-filter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = function jaItemFilter(items) {
return items.filter(item => item.data.locale === 'ja')
return items.filter(item => item.data.locale === 'ja');
};
6 changes: 3 additions & 3 deletions src/transforms/parse-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ module.exports = function(value, outputPath) {
image.setAttribute('loading', 'lazy');

const file = image.getAttribute('src');

if (file.indexOf('http') < 0) {
const dimensions = getSize('src' + file);

image.setAttribute('width', dimensions.width);
image.setAttribute('height', dimensions.height);;
image.setAttribute('height', dimensions.height);
}

// If an image has a title it means that the user added a caption
Expand Down
2 changes: 1 addition & 1 deletion src/utils/markdown-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ module.exports = markdownIt.use(mila, {
target: '_blank',
rel: 'noopener'
}
})
});