Skip to content

Commit

Permalink
feat: Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
brettflorio committed Jun 23, 2020
0 parents commit a221623
Show file tree
Hide file tree
Showing 83 changed files with 13,791 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"node": "current"
}
}]
]
}
142 changes: 142 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
const { DateTime } = require("luxon");
const htmlmin = require("html-minifier");
const yaml = require("js-yaml");
const Image = require("@11ty/eleventy-img");

// Setting this conf up front allow us to use them in our
// functions

// Note: You do not need to add markdown-it to package.json.
let markdown = require("markdown-it")({
html: true,
});

module.exports = function (eleventyConfig) {
var conf = {
dir: {
input: "src/",
output: "dist",
includes: "_includes",
layouts: "_layouts",
},
templateFormats: ["html", "md", "njk"],
htmlTemplateEngine: "njk",

// 1.1 Enable eleventy to pass dirs specified above
passthroughFileCopy: true,
};

eleventyConfig.addNunjucksShortcode(
"markdown",
(content) => `${markdown.render(content)}`
);

eleventyConfig.addNunjucksAsyncShortcode("productPicture", async function (
src,
alt
) {
var src = "src" + src;
var options = {
// Optional: use falsy value to fall back to native image size
widths: [221, 228, 284, 297, 324, 332, 375, 475],
formats: ["jpeg"], // 'png', 'webp'
urlPath: "/static/img/",
outputDir: conf.dir.output + "/static/img/",
cacheDuration: "15d",
};
if (alt === undefined) {
// You bet we throw an error on missing alt (alt="" works okay)
throw new Error(`Missing \`alt\` on myResponsiveImage from: ${src}`);
}
const stats = await Image(src, options);
const lowestSrc = stats.jpeg[0];
const sizes =
" (max-width: 257px) 221px," +
"(max-width: 360px) 324px," +
"(max-width: 411px) 375px," +
"(max-width: 320px) 284px," +
"(max-width: 667px) 297px," +
"(max-width: 1023px) 475px," +
"(max-width: 1024px) 228px," +
"(max-width: 1440px) 332px," +
"332px";
// Iterate over formats and widths
return `<picture>
${Object.values(stats)
.map((imageFormat) => {
return ` <source type="image/${
imageFormat[0].format
}" srcset="${imageFormat
.map((entry) => `${entry.url} ${entry.width}w`)
.join(", ")}" sizes="${sizes}">`;
})
.join("\n")}
<img
alt="${alt}"
src="${lowestSrc.url}"
class="h-64 object-cover w-full"
>
</picture>`;
});

// works also with addLiquidShortcode or addNunjucksAsyncShortcode
eleventyConfig.addNunjucksAsyncShortcode("myResponsiveImage", function (
src,
options
) {
// returns Promise
return Image(src, options);
});

// Folders to copy to build dir (See. 1.1)
eleventyConfig.addPassthroughCopy("src/static");

if (process.env.ELEVENTY_ENV === "production") {
// Minify HTML (including inlined CSS and JS)
eleventyConfig.addTransform("compressHTML", function (content, outputPath) {
if (outputPath.endsWith(".html")) {
const minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
});
return minified;
}
return content;
});
}

// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
eleventyConfig.addFilter("htmlDateString", (dateObj) => {
return DateTime.fromJSDate(dateObj, {
zone: "utc",
}).toFormat("yyyy-LL-dd");
});

// Add a filter to grab a youtube video id
eleventyConfig.addNunjucksFilter("youtubeId", function (value) {
// Return the ide as the first matching set of
// characters not including / or & after watch?v= or
// embed/
return value.match(/(?:watch\?v=|embed\/)([^\/&]*)/)[1];
});

// Add YAML support for data files
eleventyConfig.addDataExtension("yaml", (contents) =>
yaml.safeLoad(contents)
);

// This allows Eleventy to watch for file changes during local development.
eleventyConfig.setUseGitIgnore(false);

function sortByPriceHighToLow(values) {
const vals = [...values]; // this *seems* to prevent collection mutation...
return vals.sort((b, a) => Math.sign(a.data.price - b.data.price));
}

eleventyConfig.addFilter("sortByPriceHighToLow", sortByPriceHighToLow);

return conf;
};
129 changes: 129 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[INSERT CONTACT METHOD].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
80 changes: 80 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# Mac
.DS_Store

# Build
dist

# Vim
.*.un~
.*.swp

# VS Code
.vscode

# Don't commit temp build files
src/static/app.bundled.js
src/static/app.compiled.css
src/_includes/app.compiled.css

4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": true
}
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Original Work Copyright (c) 2020 Chris Collins
Modified Work Copyright (c) 2020 Foxy.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit a221623

Please sign in to comment.