Skip to content

Commit fa4dc3a

Browse files
committed
Install bootstrap, setup automated gh-pages build process
1 parent 993f022 commit fa4dc3a

File tree

13 files changed

+233
-11
lines changed

13 files changed

+233
-11
lines changed

.circleci/config.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,41 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: circleci/ruby:2.5.1
5+
- image: circleci/ruby:2.5.1-node
6+
branches:
7+
only:
8+
- master
69
steps:
710
- checkout
8-
- run: echo "A first hello"
11+
12+
- restore_cache:
13+
keys:
14+
- pytorch-bundle-v2-{{ checksum "Gemfile.lock" }}
15+
- pytorch-bundle-v2-
16+
17+
- run:
18+
name: Bundle Install
19+
command: bundle check || bundle install --path vendor/cache
20+
21+
- save_cache:
22+
key: pytorch-bundle-v2-{{ checksum "Gemfile.lock" }}
23+
paths:
24+
- vendor/cache
25+
26+
- restore_cache:
27+
keys:
28+
- pytorch-yarn-{{ checksum "yarn.lock" }}
29+
- pytorch-yarn-
30+
31+
- run:
32+
name: Yarn Install
33+
command: yarn install --cache-folder ~/.cache/yarn
34+
35+
- save_cache:
36+
key: pytorch-yarn-{{ checksum "yarn.lock" }}
37+
paths:
38+
- ~/.cache/yarn
39+
40+
- run:
41+
name: Build Jekyll site and push to gh-pages
42+
command: ./scripts/deploy-ghpages.sh build

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9.8.0

Makefile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
SHELL := /bin/bash
2+
BUNDLE := bundle
3+
YARN := yarn
4+
VENDOR_DIR = assets/vendor/
5+
JEKYLL := $(BUNDLE) exec jekyll
6+
7+
PROJECT_DEPS := Gemfile package.json
8+
9+
.PHONY: all clean install update
10+
11+
all : serve
12+
13+
check:
14+
$(JEKYLL) doctor
15+
$(HTMLPROOF) --check-html \
16+
--http-status-ignore 999 \
17+
--internal-domains localhost:4000 \
18+
--assume-extension \
19+
_site
20+
21+
install: $(PROJECT_DEPS)
22+
$(BUNDLE) install --path vendor/bundler
23+
$(YARN) install
24+
25+
update: $(PROJECT_DEPS)
26+
$(BUNDLE) update
27+
$(YARN) upgrade
28+
29+
include-yarn-deps:
30+
mkdir -p $(VENDOR_DIR)
31+
cp node_modules/jquery/dist/jquery.min.js $(VENDOR_DIR)
32+
cp node_modules/popper.js/dist/umd/popper.min.js $(VENDOR_DIR)
33+
cp node_modules/bootstrap/dist/js/bootstrap.min.js $(VENDOR_DIR)
34+
35+
build: install include-yarn-deps
36+
$(JEKYLL) build
37+
rm _site/Gemfile
38+
rm _site/Gemfile.lock
39+
rm _site/Makefile
40+
rm _site/package.json
41+
rm -f _site/yarn-error.log
42+
rm _site/yarn.lock
43+
rm -rf _site/scripts
44+
45+
serve: install include-yarn-deps
46+
JEKYLL_ENV=production $(JEKYLL) serve
47+
48+
build_deploy: include-yarn-deps
49+
$(JEKYLL) build
50+
rm _site/Gemfile
51+
rm _site/Gemfile.lock
52+
rm _site/Makefile
53+
rm _site/package.json
54+
rm -f _site/yarn-error.log
55+
rm _site/yarn.lock
56+
rm -rf _site/scripts

_config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@
22
title: "PyTorch Website"
33
author: "Shift Lab"
44
description: "Static website for pytorch.org"
5-
url: "https://pytorch.org"
5+
url: "https://shiftlab.github.io/pytorch"
6+
sass:
7+
load_paths:
8+
- _sass
9+
- node_modules
10+
exclude: [vendor, node_modules]
11+
github: [metadata]
12+
baseurl: ""

_includes/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<footer>
22
<p>Footer</p>
3-
</footer>
3+
</footer>

_includes/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<meta name="viewport" content="width=device-width, initial-scale=1.0">
44
<meta http-equiv="X-UA-Compatible" content="ie=edge">
55
<title>PyTorch</title>
6-
<link rel="stylesheet" href="./css/main.css">
6+
<link rel="stylesheet" href="./assets/main.css">
77
</head>

_layouts/default.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
<html lang="en">
33
{% include head.html %}
44
<body>
5-
{{ content }}
6-
{% include footer.html %}
5+
<div class="container">
6+
{{ content }}
7+
{% include footer.html %}
8+
</div>
9+
10+
<script src="{{'./assets/vendor/jquery.min.js'}}"></script>
11+
<script src="{{'./assets/vendor/popper.min.js'}}"></script>
12+
<script src="{{'./assets/vendor/bootstrap.min.js'}}"></script>
713
</body>
8-
</html>
14+
</html>

_sass/_variables.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$custom-font-size: 20px;
2+
@import "../node_modules/bootstrap/scss/variables";

assets/main.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
---
3+
4+
@import "bootstrap/scss/functions";
5+
@import "variables";
6+
@import "bootstrap/scss/bootstrap";
7+
8+
.content {
9+
font-size: $custom-font-size;
10+
}

index.html

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,39 @@
22
layout: default
33
---
44

5-
<div id="outer">
6-
<h1>PyTorch</h1>
7-
<pre>Testing Jekyll auto-build</pre>
5+
<h1>PyTorch</h1>
6+
7+
<div class="alert alert-success" role="alert">
8+
Bootstrap installed
9+
</div>
10+
11+
<div class="alert alert-danger" role="alert">
12+
Error alert
13+
</div>
14+
15+
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
16+
Launch demo modal
17+
</button>
18+
19+
<!-- Modal -->
20+
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
21+
<div class="modal-dialog" role="document">
22+
<div class="modal-content">
23+
<div class="modal-header">
24+
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
25+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
26+
<span aria-hidden="true">&times;</span>
27+
</button>
28+
</div>
29+
<div class="modal-body">
30+
...
31+
</div>
32+
<div class="modal-footer">
33+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
34+
<button type="button" class="btn btn-primary">Save changes</button>
35+
</div>
36+
</div>
37+
</div>
838
</div>
39+
40+

0 commit comments

Comments
 (0)