2023-01-09 20:10:02 +01:00
|
|
|
# Contributing to the Sass website
|
2014-04-20 00:31:20 +02:00
|
|
|
|
2018-10-27 06:35:30 +02:00
|
|
|
The Sass website is open source. See a bug or typo? Have an idea? Do the
|
2014-04-20 00:31:20 +02:00
|
|
|
following:
|
|
|
|
|
2023-01-09 20:10:02 +01:00
|
|
|
- **Please read the [Implementation Guide][ig] and the [Style Guide][sg]**
|
2018-10-27 06:35:30 +02:00
|
|
|
before contributing.
|
2023-01-09 20:10:02 +01:00
|
|
|
- Write a detailed description of what you're adding in the pull request
|
2014-04-20 00:31:20 +02:00
|
|
|
(screenshots help).
|
2023-01-09 20:10:02 +01:00
|
|
|
- If there is new design or CSS, please add @Jina as a reviewer so she can see
|
2018-10-27 06:35:30 +02:00
|
|
|
if it needs to be added to the style guide (or if a suitable alternative
|
|
|
|
exists).
|
2023-01-09 20:10:02 +01:00
|
|
|
- Submit the pull request to the `main` branch.
|
|
|
|
- Drink whisky.
|
2014-04-20 00:31:20 +02:00
|
|
|
|
|
|
|
## Running Locally
|
|
|
|
|
2023-06-20 00:12:39 +02:00
|
|
|
### Install Node
|
2014-04-20 00:31:20 +02:00
|
|
|
|
2023-01-10 18:06:25 +01:00
|
|
|
We recommend using [nvm](https://github.com/nvm-sh/nvm) for node version
|
|
|
|
management. [Install it](https://github.com/nvm-sh/nvm#installation-and-update)
|
|
|
|
if necessary, then run `nvm install` (once per active shell) to use the correct
|
|
|
|
version of node for development.
|
2014-04-20 00:31:20 +02:00
|
|
|
|
2023-01-10 18:06:25 +01:00
|
|
|
To upgrade the node version used by the Sass website, update the version number
|
|
|
|
in these places and then run `nvm install` to upgrade:
|
|
|
|
|
|
|
|
- `package.json` (`engines.node` field)
|
|
|
|
- `.nvmrc`
|
2023-06-10 17:02:00 +02:00
|
|
|
- `netlify.toml`
|
2023-06-15 19:49:54 +02:00
|
|
|
- `Dockerfile`
|
2023-01-10 18:06:25 +01:00
|
|
|
|
|
|
|
### Install dependencies
|
2014-04-20 00:31:20 +02:00
|
|
|
|
|
|
|
```
|
2023-06-20 00:12:39 +02:00
|
|
|
npm install
|
2023-01-10 18:06:25 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### Development tasks
|
|
|
|
|
|
|
|
Compile and run [Eleventy](https://www.11ty.dev/) server, with a watcher for
|
|
|
|
file changes:
|
|
|
|
|
|
|
|
```
|
2023-06-20 00:12:39 +02:00
|
|
|
npm run serve
|
2023-01-10 18:06:25 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
The site will be compiled into `_site/` and available at http://localhost:8080.
|
|
|
|
|
|
|
|
You can also run individual commands:
|
|
|
|
|
|
|
|
```
|
|
|
|
# build the static site for development
|
2023-06-20 00:12:39 +02:00
|
|
|
npm run build
|
2023-01-10 18:06:25 +01:00
|
|
|
|
|
|
|
# format and lint all files
|
2023-06-20 00:12:39 +02:00
|
|
|
npm run lint
|
2014-04-20 00:31:20 +02:00
|
|
|
```
|
|
|
|
|
2023-02-03 18:55:34 +01:00
|
|
|
## Templates
|
|
|
|
|
|
|
|
- `.liquid` files are parsed as [LiquidJS](https://liquidjs.com/) templates.
|
2023-02-25 19:38:22 +01:00
|
|
|
- To embed Markdown (or other languages) inside LiquidJS templates, use either
|
|
|
|
the `{% markdown %}` tag or the [11ty `{% renderTemplate 'md' %}`
|
|
|
|
tag](https://www.11ty.dev/docs/plugins/render/#rendertemplate). With the
|
|
|
|
latter, note that multiple languages can be used, e.g.
|
2023-02-03 18:55:34 +01:00
|
|
|
`{% 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)
|
2023-06-10 17:02:00 +02:00
|
|
|
matter_. Use Markdown selectively, especially in files that include other
|
|
|
|
non-Markdown partials.
|
|
|
|
- For example, the `{% codeExample %}` tag renders whitespace that results
|
|
|
|
in unwanted `<p>` tags when parsed as Markdown.
|
2023-02-03 18:55:34 +01:00
|
|
|
|
2015-11-27 22:36:53 +01:00
|
|
|
## Deploying
|
|
|
|
|
2023-01-10 18:06:25 +01:00
|
|
|
Every time a new commit is pushed to `main`, it will automatically be deployed
|
2023-06-10 17:02:00 +02:00
|
|
|
to sass-lang.com via [Netlify][]. Easy as that!
|
2014-04-20 00:31:20 +02:00
|
|
|
|
|
|
|
Thanks!
|
|
|
|
|
2018-10-22 23:13:05 +02:00
|
|
|
— Sass Core Team
|
2018-10-27 06:35:30 +02:00
|
|
|
|
2023-01-09 20:10:02 +01:00
|
|
|
[ig]: https://sass-lang.com/implementation
|
|
|
|
[sg]: https://sass-lang.com/styleguide
|
2023-06-10 17:02:00 +02:00
|
|
|
[Netlify]: https://www.netlify.com/
|