Skip to content

Commit

Permalink
Move recipe image assets to assets folder and update imports/docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
alfg committed Oct 12, 2019
1 parent f470a73 commit b814deb
Show file tree
Hide file tree
Showing 353 changed files with 49 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .netlify/functions-src/getRecipes.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import recipes from '../../src/recipes';
import { getRecipes } from '../../src/recipes/index';

exports.handler = function(event, context, callback) {
const r = recipes.getRecipes();
// const r = recipes.getRecipes();

return callback(null, {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ recipes: r }),
// body: JSON.stringify({ recipes: r }),
});
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The [/src/recipes/](/src/recipes/) directory contains all the drink recipes as a
}
```

* Add an image to the [/src/recipes/img](/src/recipes/img/).
* Add an image to the [/src/assets/recipes/](/src/assets/recipes/).
* Filename should match recipe filename
* JPG format, **600x400px** if possible, 200KB max in size
* source is an optional field
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion src/components/Recipe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<b-img
class="mb-4"
:src="drink.image ? require(`@/recipes/img/${drink.image}`) : null"
:src="drink.image ? require(`@/assets/recipes/${drink.image}`) : null"
:alt="drink.name"
rounded
fluid-grow
Expand Down
2 changes: 1 addition & 1 deletion src/components/RecipeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div v-for="(o, i) in paginatedItems" v-bind:key="i" class="mb-2 p-1">
<b-card
:title="o.name"
:img-src="o.image ? require(`@/recipes/img/${o.image}`) : null"
:img-src="o.image ? require(`@/assets/recipes/${o.image}`) : null"
:img-alt="o.name"
img-top
style="max-width: 20rem;"
Expand Down
2 changes: 1 addition & 1 deletion src/components/RecipeTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
>
<b-link :href="'/recipe/' + drink.filename">
<b-card-img-lazy
:src="drink.image ? require(`@/recipes/img/${drink.image}`) : null"
:src="drink.image ? require(`@/assets/recipes/${drink.image}`) : null"
:alt="drink.name"
top
/>
Expand Down
6 changes: 3 additions & 3 deletions src/recipes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ function requireAll(r) {
return r.keys();
}

const recipes = requireAll(require.context('./', true, /\.json$/));
const recipes = requireAll(require.context('./json/', true, /\.json$/));

function getRecipes() {
const items = [];

recipes.forEach(i => {
const r = i.replace('./', '').replace('.json', '');
const item = require(`./${r}`);
const item = require(`./json/${r}`);
item.filename = r;
items.push(item);
});
Expand All @@ -31,7 +31,7 @@ function getRecipesByKeywords(keyword) {

function getRecipe(id) {
const r = id.replace('./', '').replace('.json', '');
const item = require(`./${r}`);
const item = require(`./json/${r}`);
item.filename = r;
return item;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
{
"name": "Brunswick Cocktail",
"description": "Cocktail featuring wine floated over whiskey",
"github": "ajciancimino",
"ingredients": [
{
"quantity": "2",
"measure": "parts",
"ingredient": "whiskey (Tennessee rye preferred)"
},
{
"quantity": "1/2",
"measure": "parts",
"ingredient": "simple syrup"
},
{
"quantity": "3/4",
"measure": "parts",
"ingredient": "lemon juice"
},
{
"quantity": "3/4",
"measure": "parts",
"ingredient": "red wine"
}
],
"directions": [
"Mix all ingredients but wine and shake w/ ice",
"Strain into rocks glass over ice",
"Float wine over mixture"
],
"image": "brunswick-cocktail.jpg",
"keywords": [
"wine",
"cocktail",
"alcoholic",
"whiskey"
]
}
{
"name": "Brunswick Cocktail",
"description": "Cocktail featuring wine floated over whiskey",
"github": "ajciancimino",
"ingredients": [
{
"quantity": "2",
"measure": "parts",
"ingredient": "whiskey (Tennessee rye preferred)"
},
{
"quantity": "1/2",
"measure": "parts",
"ingredient": "simple syrup"
},
{
"quantity": "3/4",
"measure": "parts",
"ingredient": "lemon juice"
},
{
"quantity": "3/4",
"measure": "parts",
"ingredient": "red wine"
}
],
"directions": [
"Mix all ingredients but wine and shake w/ ice",
"Strain into rocks glass over ice",
"Float wine over mixture"
],
"image": "brunswick-cocktail.jpg",
"keywords": [
"wine",
"cocktail",
"alcoholic",
"whiskey"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b814deb

Please sign in to comment.