Skip to content

Commit

Permalink
Merge pull request #5 from oddbird/homepage
Browse files Browse the repository at this point in the history
Add homepage, global navigation, get involved, community guidelines, and install pages.
  • Loading branch information
jgerigmeyer committed Feb 3, 2023
2 parents 996261d + ba53435 commit 9c5529b
Show file tree
Hide file tree
Showing 37 changed files with 1,168 additions and 1,298 deletions.
25 changes: 0 additions & 25 deletions .eleventy.cjs

This file was deleted.

46 changes: 38 additions & 8 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,30 +1,60 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2021,
tsconfigRootDir: __dirname,
warnOnUnsupportedTypeScriptVersion: false,
},
env: {
browser: true,
es2021: true,
node: true,
},
plugins: ['simple-import-sort', 'import', '@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: false,
},
plugins: ['@typescript-eslint', 'simple-import-sort'],
settings: {
'import/resolver': {
typescript: true,
typescript: {
project: ['tsconfig.json'],
},
node: {
extensions: ['.cjs'],
},
},
},
overrides: [
{
files: ['*.cjs'],
parserOptions: {
sourceType: 'script',
},
rules: {
'import/order': 1,
'simple-import-sort/imports': 0,
'@typescript-eslint/no-var-requires': 0,
},
},
{
files: ['*.ts'],
parserOptions: {
project: ['tsconfig.json'],
},
extends: [
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
},
],
rules: {
'import/order': 0,
'sort-imports': 0,
'simple-import-sort/imports': 1,
'no-console': 1,
'no-warning-comments': [1, { terms: ['todo', 'fixme', '@@@'] }],
Expand Down
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,27 @@ yarn build
yarn lint
```

## Templates

- `.liquid` files are parsed as [LiquidJS](https://liquidjs.com/) templates.
- To embed Markdown (or other languages) inside LiquidJS templates, use the
[11ty `{% renderTemplate 'md' %}` tag](https://www.11ty.dev/docs/plugins/render/#rendertemplate). Note that multiple languages can be used, e.g.
`{% renderTemplate 'liquid,md' %}`
- To include partials, use either the
[11ty `{% renderFile %}` tag](https://www.11ty.dev/docs/plugins/render/#renderfile)
or the [LiquidJS `{% render %}` tag](https://liquidjs.com/tags/render.html).
- Note that `renderFile` requires a relative path from the root directory,
while `render` uses a relative path from the `/source/_includes/`
directory.
- Both tags create an encapsulated scope for the partial, so any variables
used in the partial must be explicitly passed in.
- `renderFile` allows overriding the template language (e.g.
`{% renderFile 'source/_includes/footer_nav.md', data, 'liquid,md' %}`),
while `render` always parses the partial as a LiquidJS template.
- `.md` files are parsed both as Markdown _and_ as LiquidJS templates.
- When using Markdown, remember that _indentation and whitespace (e.g newlines)
matter_.

## Deploying

Every time a new commit is pushed to `main`, it will automatically be deployed
Expand Down
39 changes: 0 additions & 39 deletions app.json

This file was deleted.

75 changes: 75 additions & 0 deletions eleventy.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
'use strict';

const formatDistanceToNow = require('date-fns/formatDistanceToNow');
const yaml = require('js-yaml');
const markdown = require('markdown-it');
const markdownDefList = require('markdown-it-deflist');
const typogrify = require('typogr');
const { EleventyRenderPlugin } = require('@11ty/eleventy');

/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
module.exports = (eleventyConfig) => {
eleventyConfig.addPassthroughCopy('source/assets/dist');
eleventyConfig.addPassthroughCopy('source/assets/img');
eleventyConfig.addPassthroughCopy('source/favicon.ico');

eleventyConfig.setLiquidOptions({
jsTruthy: true,
});
eleventyConfig.setUseGitIgnore(false);

const mdown = markdown({
html: true,
typographer: true,
}).use(markdownDefList);

eleventyConfig.setLibrary('md', mdown);
eleventyConfig.addDataExtension('yml, yaml', (contents) =>
yaml.load(contents),
);

// Paired shortcodes...
eleventyConfig.addPairedLiquidShortcode('markdown', (content) =>
mdown.render(content),
);

eleventyConfig.addPairedLiquidShortcode('markdownInline', (content) =>
mdown.renderInline(content),
);

eleventyConfig.addPairedLiquidShortcode('typogr', (content) =>
typogrify.typogrify(content),
);

// Filters...
eleventyConfig.addLiquidFilter('formatDistanceToNow', (date) => {
return formatDistanceToNow(new Date(date));
});

eleventyConfig.addLiquidFilter('markdown', (content) =>
mdown.render(content),
);

eleventyConfig.addLiquidFilter('markdownInline', (content) =>
mdown.renderInline(content),
);

eleventyConfig.addLiquidFilter('typogr', (content) =>
typogrify.typogrify(content),
);

eleventyConfig.addLiquidFilter('isTypedoc', (page) =>
page.url.startsWith('/documentation/js-api/'),
);

eleventyConfig.addPlugin(EleventyRenderPlugin);

// settings
return {
dir: {
input: 'source',
includes: '_includes',
layouts: '_layouts',
},
};
};
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"build-dev:scripts": "rollup -c",
"build-prod:scripts": "BABEL_ENV=production rollup -c",
"watch:scripts": "npm run build-dev:scripts -- -w",
"build:11ty": "eleventy --config=.eleventy.cjs",
"watch:11ty": "eleventy --config=.eleventy.cjs --serve",
"build:11ty": "eleventy",
"watch:11ty": "eleventy --serve --incremental",
"tsc": "tsc",
"prettier": "prettier --write .",
"prettier:ci": "prettier --check .",
Expand All @@ -39,7 +39,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@11ty/eleventy": "^1.0.2",
"@11ty/eleventy": "^2.0.0-0",
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
Expand All @@ -53,13 +53,16 @@
"@types/node": "^16",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"date-fns": "^2.29.3",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-simple-import-sort": "^10.0.0",
"jquery": "^3.6.3",
"jquery-ui": "^1.13.2",
"js-yaml": "^4.1.0",
"markdown-it-deflist": "^2.1.0",
"netlify-plugin-11ty": "^1.3.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.3",
Expand All @@ -69,7 +72,8 @@
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-standard-scss": "^6.1.0",
"typedoc": "^0.23.24",
"typescript": "^4.9.4"
"typescript": "^4.9.4",
"typogr": "^0.6.8"
},
"resolutions": {
"tslib": ">=2"
Expand Down
4 changes: 4 additions & 0 deletions source/_data/alerts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- heading: Black Lives Matter
body: >
Sass stands with the protesters against police violence. We encourage our
users to **get in the streets and join them if you can**.
30 changes: 5 additions & 25 deletions source/_includes/footer.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@
<div class="sl-l-container sl-l-section">
<div class="sl-l-grid sl-l-grid--full sl-l-large-grid--fit sl-l-large-grid--center sl-l-large-grid--gutters">
<div class="sl-l-grid__column">
Sass &copy; 2006&ndash;{{ 'now' | date: '%Y' }} the Sass team, and numerous contributors.
It is available for use and modification under the <a href="https://github.com/sass/dart-sass/blob/master/LICENSE">MIT&nbsp;License</a>.
{% renderTemplate 'liquid,md' %}
Sass &copy; 2006&ndash;{{ 'now' | date: '%Y' }} the Sass team, and numerous contributors.
It is available for use and modification under the [MIT License](https://github.com/sass/dart-sass/blob/master/LICENSE).
{% endrenderTemplate %}

<nav class="sl-c-list-horizontal-wrapper">
<ul>
<li><a href="https://github.com/sass">Sass on GitHub</a></li>
<li><a href="https://github.com/sass/sass-site">Website Source Code</a></li>
<li><a href="/styleguide">Style Guide</a></li>
<li><a href="/community-guidelines">Community Guidelines</a></li>
</ul>
</nav>
{% renderFile 'source/_includes/footer_nav.md' %}
</div>
<div class="sl-l-grid__column sl-l-large-grid__column--auto-size sl-l-large-grid--justify-right">
<a
Expand All @@ -28,21 +23,6 @@
alt="Powered by MacStadium"
class="mac-stadium-icon"
src="https://uploads-ssl.webflow.com/5ac3c046c82724970fc60918/5c019d917bba312af7553b49_MacStadium-developerlogo.png"></a>
<script>
!function(d, s, id) {
var js,
fjs = d.getElementsByTagName(s)[0],
p = /^http:/.test(d.location)
? 'http'
: 'https';
if (! d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');
</script>
</div>
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions source/_includes/footer_nav.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<nav class="sl-c-list-horizontal-wrapper">

- [Sass on GitHub](https://github.com/sass)
- [Website Source Code](https://github.com/sass/sass-site)
- [Style Guide](/styleguide)
- [Community Guidelines](/community-guidelines)

</nav>
25 changes: 25 additions & 0 deletions source/_includes/header.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<header
class="sl-r-banner"
itemtype="http://schema.org/WPHeader"
itemscope="itemscope"
role="banner">
{% for alert in alerts | default: [] %}
<div class="sl-c-alert sl-c-alert--special">
<div class="sl-l-container">
<h2 class="sl-c-alert-title">{{ alert.heading }}</h2>
{{ alert.body | markdown }}
</div>
</div>
{% endfor %}

<div class="sl-c-pop-stripe"></div>
<div class="sl-l-container">
<div class="sl-l-grid sl-l-grid--full sl-l-large-grid--fit sl-l-large-grid--center sl-l-large-grid--gutters">
<p class="sl-l-grid__column sl-r-banner__brand">
<a href="/"><img height="48" alt="Sass" src="/assets/img/logos/logo.svg"></a>
</p>

{% renderFile 'source/_includes/header_nav.md' %}
</div>
</div>
</header>
15 changes: 15 additions & 0 deletions source/_includes/header_nav.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<nav
class="sl-r-banner__navigation sl-l-grid__column sl-l-large-grid sl-l-large-grid__column--auto-size sl-c-list-horizontal-wrapper"
itemtype="http://schema.org/SiteNavigationElement"
itemscope="itemscope"
role="navigation"
aria-label="Site navigation">

- [Install](/install)
- [Learn Sass](/guide)
- [Blog](/blog)
- [Documentation](/documentation)
- [Get Involved](/community)
- <div id="docsearch"></div>

</nav>
Loading

0 comments on commit 9c5529b

Please sign in to comment.