Compare commits
2 commits
840fcf87c6
...
67290477b2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67290477b2 | ||
|
|
7aef0505f1 |
|
|
@ -1,24 +1,31 @@
|
||||||
const Image = require('@11ty/eleventy-img');
|
/**
|
||||||
const util = require('util');
|
* Hint VS Code for eleventyConfig autocompletion.
|
||||||
|
* © Henry Desroches - https://gist.github.com/xdesro/69583b25d281d055cd12b144381123bf
|
||||||
|
* @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig -
|
||||||
|
* @returns {Object} -
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Image from '@11ty/eleventy-img';
|
||||||
|
import util from 'util';
|
||||||
|
|
||||||
const emojiRegex = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/ug
|
const emojiRegex = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/ug
|
||||||
|
|
||||||
module.exports = config => {
|
export default async function (eleventyConfig) {
|
||||||
config.setUseGitIgnore(false);
|
eleventyConfig.setUseGitIgnore(false);
|
||||||
config.addWatchTarget("./src/_includes/css/main.css");
|
eleventyConfig.addWatchTarget("./src/_includes/css/main.css");
|
||||||
|
|
||||||
config.addPassthroughCopy({ public: './' });
|
eleventyConfig.addPassthroughCopy({ public: './' });
|
||||||
config.addPassthroughCopy('src/img');
|
eleventyConfig.addPassthroughCopy('src/img');
|
||||||
config.addPassthroughCopy('src/fonts');
|
eleventyConfig.addPassthroughCopy('src/fonts');
|
||||||
config.addPassthroughCopy('src/admin');
|
eleventyConfig.addPassthroughCopy('src/admin');
|
||||||
|
|
||||||
|
|
||||||
/* Collections */
|
/* Collections */
|
||||||
config.addCollection('recipes', collection => {
|
eleventyConfig.addCollection('recipes', collection => {
|
||||||
return [...collection.getFilteredByGlob('./src/recipes/*.md')];
|
return [...collection.getFilteredByGlob('./src/recipes/*.md')];
|
||||||
});
|
});
|
||||||
|
|
||||||
config.addCollection('tagList', collection => {
|
eleventyConfig.addCollection('tagList', collection => {
|
||||||
const tagsSet = new Set();
|
const tagsSet = new Set();
|
||||||
collection.getAll().forEach(item => {
|
collection.getAll().forEach(item => {
|
||||||
if (!item.data.tags) return;
|
if (!item.data.tags) return;
|
||||||
|
|
@ -38,15 +45,15 @@ module.exports = config => {
|
||||||
|
|
||||||
|
|
||||||
/* Filters */
|
/* Filters */
|
||||||
config.addFilter('console', function(value) {
|
eleventyConfig.addFilter('console', function(value) {
|
||||||
return util.inspect(value);
|
return util.inspect(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
config.addFilter('noEmoji', function(value) {
|
eleventyConfig.addFilter('noEmoji', function(value) {
|
||||||
return value.replace(emojiRegex, '').trim();
|
return value.replace(emojiRegex, '').trim();
|
||||||
});
|
});
|
||||||
|
|
||||||
config.addFilter('onlyEmoji', function(value) {
|
eleventyConfig.addFilter('onlyEmoji', function(value) {
|
||||||
let match = value.match(emojiRegex);
|
let match = value.match(emojiRegex);
|
||||||
// If the string doesn't contain any emoji, instead we output the first letter wrapped in some custom styles
|
// If the string doesn't contain any emoji, instead we output the first letter wrapped in some custom styles
|
||||||
if (!match) {
|
if (!match) {
|
||||||
|
|
@ -55,14 +62,14 @@ module.exports = config => {
|
||||||
return Array.isArray(match) ? match.join('') : match;
|
return Array.isArray(match) ? match.join('') : match;
|
||||||
});
|
});
|
||||||
|
|
||||||
config.addFilter('limit', (arr, limit) => arr.slice(0, limit));
|
eleventyConfig.addFilter('limit', (arr, limit) => arr.slice(0, limit));
|
||||||
|
|
||||||
config.addFilter('lowercase', function(value) {
|
eleventyConfig.addFilter('lowercase', function(value) {
|
||||||
return value.toLowerCase();
|
return value.toLowerCase();
|
||||||
});
|
});
|
||||||
|
|
||||||
// This workaround is needed so we can transform it back into an array with Alpine (we can't split on "," as it can be included within the items)
|
// This workaround is needed so we can transform it back into an array with Alpine (we can't split on "," as it can be included within the items)
|
||||||
config.addFilter('arrayToString', function(value) {
|
eleventyConfig.addFilter('arrayToString', function(value) {
|
||||||
return encodeURI(value.join('£'));
|
return encodeURI(value.join('£'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -86,8 +93,8 @@ module.exports = config => {
|
||||||
return Image.generateHTML(metadata, imageAttributes);
|
return Image.generateHTML(metadata, imageAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
config.addNunjucksAsyncShortcode('recipeimage', imageShortcode);
|
eleventyConfig.addNunjucksAsyncShortcode('recipeimage', imageShortcode);
|
||||||
config.addShortcode('year', () => `${new Date().getFullYear()}`);
|
eleventyConfig.addShortcode('year', () => `${new Date().getFullYear()}`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dir: {
|
dir: {
|
||||||
9842
package-lock.json
generated
9842
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
|
@ -3,21 +3,22 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "A starter kit to make your own online recipe cookbook",
|
"description": "A starter kit to make your own online recipe cookbook",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:css": "sass src/scss/main.scss:src/_includes/css/main.css --watch --style=compressed",
|
"dev:css": "sass src/scss/main.scss:src/_includes/css/main.css --watch --style=compressed",
|
||||||
"dev:11ty": "eleventy --serve",
|
"dev:11ty": "eleventy --serve",
|
||||||
"dev": "npm-run-all --parallel dev:css dev:11ty",
|
"dev": "npm-run-all --parallel dev:*",
|
||||||
"prod:css": "sass src/scss/main.scss:src/_includes/css/main.css --style=compressed",
|
"prod:css": "sass src/scss/main.scss:src/_includes/css/main.css --style=compressed",
|
||||||
"prod:11ty": "eleventy",
|
"prod:11ty": "eleventy",
|
||||||
"build": "npm-run-all prod:css prod:11ty"
|
"build": "npm-run-all prod:*"
|
||||||
},
|
},
|
||||||
"author": "Maël Brunet",
|
"author": "Maël Brunet",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^0.12.1",
|
"@11ty/eleventy": "^3.0.0",
|
||||||
"@11ty/eleventy-img": "^0.8.3",
|
"@11ty/eleventy-img": "^6.0.1",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"sass": "^1.32.12"
|
"sass": "^1.86.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"alpinejs": "^2.8.2"
|
"alpinejs": "^2.8.2"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
@use "mixins";
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--color-grey-100: #F9FAFB;
|
--color-grey-100: #F9FAFB;
|
||||||
--color-grey-200: #F3F4F6;
|
--color-grey-200: #F3F4F6;
|
||||||
|
|
@ -32,7 +34,7 @@ main {
|
||||||
section {
|
section {
|
||||||
padding: 30px 0;
|
padding: 30px 0;
|
||||||
|
|
||||||
@include mq(medium) {
|
@include mixins.mq(medium) {
|
||||||
padding: 60px 0;
|
padding: 60px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
@use "sass:string";
|
||||||
|
@use "sass:map";
|
||||||
|
|
||||||
$breakpoints-map: (
|
$breakpoints-map: (
|
||||||
small: "all and (min-width: 576px)",
|
small: "all and (min-width: 576px)",
|
||||||
medium: "all and (min-width: 768px)",
|
medium: "all and (min-width: 768px)",
|
||||||
|
|
@ -9,11 +12,11 @@ $breakpoints-map: (
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
@mixin mq($breakpoint-name) {
|
@mixin mq($breakpoint-name) {
|
||||||
// sanitize variable
|
// sanitize variable
|
||||||
$breakpoint-name: unquote($breakpoint-name);
|
$breakpoint-name: string.unquote($breakpoint-name);
|
||||||
|
|
||||||
// check if passed name is in $breakpoints-map
|
// check if passed name is in $breakpoints-map
|
||||||
@if map-has-key($breakpoints-map, $breakpoint-name) {
|
@if map.has-key($breakpoints-map, $breakpoint-name) {
|
||||||
$breakpoint-query: map-get($breakpoints-map, $breakpoint-name);
|
$breakpoint-query: map.get($breakpoints-map, $breakpoint-name);
|
||||||
|
|
||||||
// write media query
|
// write media query
|
||||||
@media #{$breakpoint-query} {
|
@media #{$breakpoint-query} {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
@use "../mixins";
|
||||||
|
|
||||||
.c-recipe__header-image {
|
.c-recipe__header-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
|
|
@ -36,7 +38,7 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 30px;
|
gap: 30px;
|
||||||
|
|
||||||
@include mq(medium) {
|
@include mixins.mq(medium) {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 400px 1fr;
|
grid-template-columns: 400px 1fr;
|
||||||
grid-template-rows: min-content 1fr;
|
grid-template-rows: min-content 1fr;
|
||||||
|
|
@ -52,7 +54,7 @@
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
|
||||||
@include mq(medium) {
|
@include mixins.mq(medium) {
|
||||||
grid-area: tags;
|
grid-area: tags;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +62,7 @@
|
||||||
|
|
||||||
|
|
||||||
.c-recipe__ingredients-wrapper {
|
.c-recipe__ingredients-wrapper {
|
||||||
@include mq(medium) {
|
@include mixins.mq(medium) {
|
||||||
grid-area: ingredients;
|
grid-area: ingredients;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +85,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.c-recipe__instructions-wrapper {
|
.c-recipe__instructions-wrapper {
|
||||||
@include mq(medium) {
|
@include mixins.mq(medium) {
|
||||||
grid-area: instructions;
|
grid-area: instructions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
@use "../mixins";
|
||||||
|
|
||||||
.c-search__search-toggle {
|
.c-search__search-toggle {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
@ -31,7 +33,7 @@
|
||||||
box-shadow: var(--shadow-xl);
|
box-shadow: var(--shadow-xl);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
|
||||||
@include mq(medium) {
|
@include mixins.mq(medium) {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
@import "reset.scss";
|
@use "reset";
|
||||||
@import "mixins.scss";
|
@use "mixins";
|
||||||
@import "utility.scss";
|
@use "utility";
|
||||||
@import "global.scss";
|
@use "global";
|
||||||
|
|
||||||
@import "typography.scss";
|
@use "typography";
|
||||||
@import "layout.scss";
|
@use "layout";
|
||||||
|
|
||||||
@import "components/about.scss";
|
@use "components/about";
|
||||||
@import "components/card.scss";
|
@use "components/card";
|
||||||
@import "components/home.scss";
|
@use "components/home";
|
||||||
@import "components/nav.scss";
|
@use "components/nav";
|
||||||
@import "components/recipe.scss";
|
@use "components/recipe";
|
||||||
@import "components/recipe-tags.scss";
|
@use "components/recipe-tags";
|
||||||
@import "components/search.scss";
|
@use "components/search";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue