2019-02-06 17:09:27 +03:00
[![CircleCI ](https://circleci.com/gh/mozilla/extension-workshop/tree/master.svg?style=svg )](https://circleci.com/gh/mozilla/extension-workshop/tree/master)
2019-01-16 22:01:00 +03:00
# Extension Workshop
2019-03-28 12:48:47 +03:00
Launchpad for why and how to build Firefox extensions.
2019-01-16 22:01:00 +03:00
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
### Prerequisites
2019-03-25 21:04:33 +03:00
- [Ruby 2.6.1 ](https://www.ruby-lang.org/en/downloads/ ), a dynamic open-source programming language
2019-02-05 21:26:13 +03:00
- [Jekyll ](https://jekyllrb.com ) site generator for [Github Pages ](https://pages.github.com )
- [Yarn ](https://yarnpkg.com/en/ ) Package Manager
2019-02-05 17:25:53 +03:00
Once you have Jekyll and yarn insalled you'll need to install the dependencies:
```
bundle install
yarn install
```
Then to run locally in devlopment run:
```
2019-02-13 21:46:38 +03:00
yarn start
2019-02-05 17:25:53 +03:00
```
2019-01-17 01:52:36 +03:00
2019-02-13 21:57:56 +03:00
Note: Running locally will show unpublished content that uses the `published: false` convention in frontmatter. Content with `published: false` will not be available on stage or production.
2019-02-13 21:46:38 +03:00
### Available yarn commands
| Command | Description |
| ------------------- | --------------------------------------------------------------------------------------- |
2019-02-15 15:48:19 +03:00
| yarn clean | Clears the output directly and cleans the .jekyll-cache. |
| yarn build | Builds the site. |
| yarn start | Starts jekyll and includes unpublished content. (Note the first run is slow!) |
2019-02-13 21:46:38 +03:00
| yarn start-prodlike | Starts jekyll and doesn't include unpublished content for a production-like experience. |
2019-01-17 01:52:36 +03:00
## Content Updates
2019-06-03 17:41:03 +03:00
This site has three templates: a full-width page, a side-bar page for documentation, and a Content Guidelines page
2019-01-17 01:52:36 +03:00
### How to add a Content Guidelines page
#### Create a new page
1. Create new file
2. Add header (see example below)
2019-02-08 15:35:08 +03:00
3. Copy 'modules' needed from `content-guidelines/master-template.md` and paste in new file
4. Save as markdown: `content-guidelines/page-name.md`
2019-01-16 22:01:00 +03:00
```
2019-01-17 01:52:36 +03:00
---
2019-06-03 17:41:03 +03:00
layout: guides
2019-01-17 01:52:36 +03:00
title: Page Name
permalink: /content-guidelines/page-name/
2019-02-13 21:46:38 +03:00
published: false
2019-01-17 01:52:36 +03:00
---
2019-01-16 22:01:00 +03:00
```
2019-02-13 22:10:47 +03:00
Note: `published: false` will withhold this content from stage and production, to publish content, remove this line.
2019-02-13 21:46:38 +03:00
2019-01-17 01:52:36 +03:00
#### Upload media
2019-01-16 22:01:00 +03:00
2019-02-05 17:25:53 +03:00
1. Add the image files to `_assets/img/`
2019-01-17 01:52:36 +03:00
2. In your page, link to images using this page structure:
2019-01-16 22:01:00 +03:00
2019-03-28 12:48:47 +03:00
This tag will output an entire `img` element. Note: that using `@optim` enables the jekyll asset pipeline to optimize the image. This is always recommended unless you see an issue with the output.
2019-02-05 17:25:53 +03:00
2019-01-16 22:01:00 +03:00
```
2019-02-06 15:25:23 +03:00
{% asset "image.jpg" @optim %}
2019-01-16 22:01:00 +03:00
```
2019-02-05 17:25:53 +03:00
For finer control you can use:
2019-02-26 16:55:24 +03:00
```html
2019-02-06 15:25:23 +03:00
< img src = "{% asset " image . jpg " @path @optim %}" someattr = "whatever" />
2019-02-05 17:25:53 +03:00
```
2019-02-26 16:55:24 +03:00
Here's an example using markdown - note you need to add `@path` and `@optim` .
```markdown
![Remembear subtitle screenshot ]({% asset "content-guidelines/remembear-subtitle.png" @path @optim %} "Remembear subtitle text" )
```
2019-01-17 01:52:36 +03:00
#### Add the page to the menu
2019-02-08 15:35:08 +03:00
Go to `_data/content-guidelines-pages.yaml` and add a new entry for your page:
2019-01-16 22:01:00 +03:00
```
2019-01-17 01:52:36 +03:00
- title: "Page Name"
url: "/content-guidelines/page-name/"
2019-02-14 14:57:05 +03:00
draft-label: true
2019-01-16 22:01:00 +03:00
```
2019-02-14 14:57:05 +03:00
#### Controlling draft labelling
2019-02-08 15:35:08 +03:00
2019-02-14 14:57:05 +03:00
If you don't want the page to be labelled as a draft, as and when it's ready remove `draft-label: true` from the relevant entry in `_data/content-guidelines.yaml`
2019-02-08 15:35:08 +03:00
2019-01-16 22:01:00 +03:00
## Deployment
2019-02-05 17:25:53 +03:00
The site is auto-deployed on commits to master to https://extensionworkshop.allizom.org/
Tagged commits will be auto deployed to production.