Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
🔥 Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonEtco committed Jul 26, 2017
0 parents commit 4ff5ba5
Show file tree
Hide file tree
Showing 16 changed files with 331 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
_site
Gemfile.lock
*.gem
.jekyll-metadata
.DS_store
.bundle
bin
vendor
node_modules
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'github-pages', group: :jekyll_plugins
gem 'jekyll-octicons'

gemspec
115 changes: 115 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# GitHub Website Starter

This is a simple Jekyll site that has everything you should need to get started building a GitHub website.

## Usage

Use this repository, or duplicate it for your next project and run:

```
$ script/bootstrap
$ script/server
```

## Setup

Never run a Jekyll site on your GitHub laptop? Run through these steps:

1. **Install Strap**
- Steps are in the [github/github docs](https://github.com/github/github/blob/master/docs/strap.md)
- This preps your computer by installing the proper tooling and security options.
2. **Setup Ruby**
- Install rbenv via Homebrew: `brew install rbenv`.
- Download a version of Ruby via rbenv (e.g., `rbenv install 2.2.3`). See <https://gorails.com/setup/osx/10.11-el-capitan>.
- Make it the global version of Ruby with `rbenv global 2.2.3`, or the local version with `rbenv local 2.2.3`.
3. **Install Jekyll and other gems** with `gem install bundler sass jekyll rouge`
4. Profit!

## What's included?

* A very basic Jekyll scaffolding to build from as you require additional layouts, includes, data files, and pages.

* Primer, our front-end framework, and all its packages. You can [read documentation here](https://github.com/styleguide/css/styles). Include what you need within the `style.scss` file at the root of the repository.

* GitHub's icons, [Octicons](https://octicons.github.com/).

## Customizing

### Stylesheet

If you'd like to add your own custom styles, add them to `style.scss`, located at the root of the repository. We prefer adding new Sass files to the `_sass` directory to stay organized, but you can also add styles to right to `style.scss`.

### Layouts

If you'd like to change the theme's HTML layout, modify or duplicate the `_layouts/default.html` as needed. Whatever you name the file in `_layouts` is how you'll refer to it from your pages and posts as you create them.

For example, if you created a `page.html` layout for an About page, the top of your `about.md` file would require:

```
---
layout: page
title: about
---
*Page content here...*
```

Jekyll layouts can also be nested. If you love everything about the `default.html` layout and want to add more structure within it, create a new layout and add the appropriate front matter at the top:

```
---
layout: default
---
*Additional layout HTML here...*
```

## Staging sites

If you need a private, internal-only staging instance for your project, you have two options that make use of secondary repos on <https://GHE.io>.

### Option 1

For super simple sites that make no use of custom Jekyll plugins (e.g., our Octicons plugin), you can add a new Git remote and push your changes there.

```bash
git add remote staging https://ghe.io/user/repo
git push staging gh-pages
```

From there, your Jekyll project will be built on GHE.io's Pages instance and available at `https://pages.ghe.io/user/repo`. You may use any user (your own, `github`, etc) and repo you wish.

### Option 2

For more complex projects, a build and publish script, `script/stage`, is needed. This is helpful for when you have a custom `baseurl` or non-whitelisted Jekyll plugins. **Before using it, this script must be customized.**

| Option | Default value | Description |
| --- | --- | --- |
| `account` | `github` | Doesn't need replacing, but it _is_ customizable. This refers to the user or organization account on GHE.io. |
| `repo` | `your-staging-repo` | **Needs replacing before using.** This is the name of the staging repository in the `account`. |

When you're all set, open Terminal to give the script permission to run:

```bash
chmod 0755 script/stage
```

Then, execute the script:

```bash
script/stage
```

This will compile your Jekyll site, create a temporary Git repository on the fly, and then push that to your GHE.io repository. Within a couple minutes, your site will be staged `https://pages.ghe.io/{account}/{your-staging-repo}`.

**Need multiple staging repositories?** Create your additional repositories under the same user or org account, then specify the repository name in Termimal:

```bash
script/stage staging2
```

## I need help!

* If you need help with web design, content, or structure, you can reach out to anyone on the [@github/web-design](https://github.com/orgs/github/teams/web-design) team.
* If you need help with CSS or brand, you can talk to anyone on the [@github/design-systems](https://github.com/orgs/github/teams/design-systems) team.
24 changes: 24 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
title: Your awesome title
description: A catchy tagline

twitter:
username: github

gems:
- jekyll-feed
- jekyll-octicons
- jekyll-seo-tag
- jekyll-sitemap

sass:
load_paths:
- _sass
- node_modules

exclude:
- Gemfile
- Gemfile.lock
- README.md
- bin
- vendor
- node_modules
4 changes: 4 additions & 0 deletions _includes/foot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% comment %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/script.js"></script>
{% endcomment %}
10 changes: 10 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="content-language" content="en-gb">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href={{ "style.css?" | append: site.github.build_revision | absolute_url }} />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700" rel="stylesheet">
{% seo %}
{% feed_meta %}
</head>
9 changes: 9 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<html>
{% include head.html %}
<body class="bg-gray-light">
{{ content }}

{% include foot.html %}
</body>
</html>
6 changes: 6 additions & 0 deletions _sass/example-custom-styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Put any additional custom CSS in files like this one within the `_sass`
// directory so you can import into the main `styles.scss` file.

.example {
display: block;
}
19 changes: 19 additions & 0 deletions github-website-starter.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# encoding: utf-8

Gem::Specification.new do |s|
s.name = 'github-website-starter'
s.version = '0.0.1'
s.authors = ['GitHub, Inc.']
s.email = ['[email protected]']
s.homepage = 'https://github.com/primer/github-website-starter'
s.summary = "Primer is a Jekyll theme for GitHub Pages based on GitHub's Primer styles"

s.files = `git ls-files -z`.split("\x0").select do |f|
f.match(%r{^(assets|_(includes|layouts|sass)/|(LICENSE|README)((\.(txt|md)|$)))}i)
end

s.platform = Gem::Platform::RUBY
s.license = 'None'

s.add_dependency 'jekyll', '~> 3.3'
end
46 changes: 46 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
layout: default
---

<div class="py-md-6">
<div class="container-lg mx-auto py-5 px-4 px-md-6 bg-white border rounded-2">
{% octicon mark-github height:100 class:"d-block mt-md-6 mx-auto text-center" aria-label:github-logomark %}
<h1 class="alt-h1 lh-condensed mt-4 mb-3 text-center">Website starter kit</h1>
<p class="alt-lead text-center col-md-8 mx-auto mb-md-6">
This is a simple Jekyll site that has everything you should need to get started building a GitHub website.
</p>
<div class="clearfix gut-lg px-md-5 my-4 mt-md-6 pt-lg-5">
<div class="col-md-6 float-left">
<h2 class="alt-h3 mb-3">
What's included?
</h2>
<ul class="f4">
<li class="mb-2">
A very basic Jekyll site that you can add layouts, includes, data files, and pages to.
</li>
<li class="mb-2">
Our Primer CSS framework, and all its packages: primer-core, primer-marketing, and primer-product. You can <a href="https://github.com/styleguide/css/styles">read documentation here</a>. Don't forget to comment out the packages you aren't using in your index.scss file!
</li>
<li class="mb-2">
GitHub's icons, <a href="https://octicons.github.com/">Octicons</a>
</li>
</ul>
</div>
<div class="col-md-6 float-left">
<h2 class="alt-h3 mb-3">
I need help!
</h2>
<p class="f4">
If you need help on the web side of things, you can reach out to anyone on the <a href="https://github.com/orgs/github/teams/web-design">@github/web-design</a> team.
</p>
<p class="f4">
If you need help with CSS, you can talk to anyone on the <a href="https://github.com/orgs/github/teams/design-systems">@github/design-systems team</a>.
</p>
</div>
</div>
<div class="text-center my-6">
<a class="btn btn-outline" href="https://github.com/github/website-starter">
View the website-starter repository
</a>
</div>
</div>
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"private": true,
"dependencies": {
"octicons": "^5.0.1",
"primer-css": "^6.0.0"
}
}
12 changes: 12 additions & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -e
export CC=gcc

echo "==> Installing gem dependencies…"
bundle check --path vendor/gems 2>&1 > /dev/null || {
time bundle install --binstubs bin --path vendor/gems
}

echo "==> Installing node dependencies…"
npm install
6 changes: 6 additions & 0 deletions script/cibuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -e

DISABLE_WHITELIST=1 bundle exec jekyll build
gem build github-website-starter.gemspec
5 changes: 5 additions & 0 deletions script/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -e

DISABLE_WHITELIST=1 bundle exec jekyll serve --watch --incremental
42 changes: 42 additions & 0 deletions script/stage
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

red=$'\e[1;31m'
grn=$'\e[1;32m'
end=$'\e[0m'

account='github'

if [ "$1" = "" ]
then
repo="your-staging-repo"
else
repo=$1
fi

# Build the site
#
# Generate the Jekyll site with an alterate baseurl for the intenral-only
# staging site, but don't start a local server.
printf "\n${grn}# Building site...\n--------------------------------------------------${end}\n"
DISABLE_WHITELIST=1 bundle exec jekyll build --baseurl "/${account}/${repo}"

# Create a temp Git repo to push from
#
# 1. From the compiled Jekyll `_site` directory
# 2. Initialize a new repo within that directory
# 3. Add a new remote called staging that we can push to
# 4. Add all our files
# 5. Write a generic commit message
printf "\n${grn}# Creating a temp Git repo...\n--------------------------------------------------${end}\n"
cd _site && git init && git remote add staging https://ghe.io/${account}/${repo} && git add . && git commit -m "Staging latest changes"

# Push the site
#
# Push the new `_site` temporary repo to our remote staging repo, then remove
# the remote again to do it all over again afterwards.
printf "\n${grn}# Publishing...\n--------------------------------------------------${end}\n"
git push staging master:gh-pages --force && git remote rm staging

# Celebrate and open the staging site
printf "\n${grn}# Success!${end}\n"
open https://pages.ghe.io/${account}/${repo}/
11 changes: 11 additions & 0 deletions style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
---

// Import what you need from Primer (stored in local `node_modules` directory)
@import "primer-base/index.scss";
@import "primer-core/index.scss";
@import "primer-product/index.scss";
@import "primer-marketing/index.scss";

// Then import custom Sass from `_sass` as needed
@import "example-custom-styles.scss";

0 comments on commit 4ff5ba5

Please sign in to comment.