kengz

Combining Google WSK and Tinypress

Hello!

Welcome to my new page - a website-blog combo. Let’s see how it’s made.

Keng is really lazy; he wants to code as little as possible for this project.

We have two aims here:

  • a website with sections for different topics
  • a section dedicated for blogging

Let’s get started. The source code is hosted on my repo.

We will host the site with Github Pages. Follow their instructions.

For the website we use Google Web Starter Kit (WSK). It is styled with Google MDL. You can also see it as a static-site generator. WSK houses a lot of optimization tools written by the Google team, and it uses familiar build tools such as minify and gulp for streamlined building.

For blogging we use Tinypress, which is really minimal - just write your post on the site in Markdown, then hit post. Tinypress will then push your material to your github pages.

But, it’s not really that easy, is it? We wish to house the blog under a section of the website. The problem is - Tinypress or Jekyll needs to control and setup the root index.html, i.e. it needs an empty repo to create a full site with its own resources. So, if you start with Tinypress, you can’t really customize it much to be a website; instead you’ll just get a bare blog.

So, Keng spent some time cracking Tinypress, and hacked it to merge under the Google WSK website.

Build System

Suppose you have set up your Github Pages together with the CNAME. Note that Github Pages needs an index.html at the root; this is a must.

Next, clone the Google WSK elsewhere and copy the content (except its .git!) into your Github Pages repo. We need to hack its gulp to tweak the default build.

Suppose you know how to run gulp; otherwise it’s really simple. Just install it, and run the commands from the terminal at project root.

This is how WSK organizes their folders and builds:

  • app/ is where you do all the developments and tests. The app/ folder contains all website resources such as the .html, .css, .scss and .js files. Summon the dev build/preview by the command gulp serve.

  • dist/ houses the files for deployment. gulp will source from app/, minifies and optimizes files, and copy the built files to dist/. gulp serve:main runs the build then pulls up a deployment preview.

Now, recall that Github Pages requires the root folder to be the deployment build folder, since it needs index.html at root. Keng has modified the gulpfile so that the deployment build writes to the root. Use the same gulp commands as before.

Website

Now that the build system is set up, you can design the site. The original WSK provides a good starting boilerplate. Refer to Google MDL for usage. Or, you can look at the my app/ folder. The page you’re currently viewing has multiple tabs for different sections.

For Tinypress to be able to inject under the blog section, we add the template string snippet in app/index.html, like so:

<div class="wrap">
  <div class="container content ">
    <div class="posts">
       ...<!-- template string here -->
    </div>
  </div>
</div>

Put your custom .css files under app/styles/, and link them in index.html under the build:css clause.

<!-- Your styles -->
<!-- build:css styles/main.min.css -->
<link rel="stylesheet" href="styles/yourstyle.css">
<!-- endbuild -->

Put your custom .js files under app/scripts/, and link them in index.html under the build:js clause.

<!-- build:js scripts/main.min.js -->
<script src="scripts/main.js"></script>
<script src="scripts/github.js"></script>
<!-- endbuild -->

The gulp build system will pick up the resources, minify and optimize them, then relink the new resources for you.

Blog

Next, we wish to house the Tinypress a section, without changing how we post from it. Recall also, now that we have occupied the root folder, Tinypress cannot setup its resources normally. We need to hack.

Tinypress uses template strings. You will see the folders _includes/, _layouts/ and _posts. Just so that Tinypress still gets access to the root index.html, we add tinypress_index.html.

The deployment build will finish building the resources, move the completed build index.html into layout_preview.html for live preview, then copy tinypress_index.html into index.html for Tinypress to use.

With the template string we injected earlier into app/index.html, now Tinypress gets a handle on the repo to inject the Markdown blog contents.

Build

You’re basically done. With the build system set up, and a small hack for Tinypress, you can update and customize the website however you like, and can write blog posts very easily from Tinypress. The best of both worlds!

Hello,

my name is Keng.

I do silly things, like:

This Math section is under Construction

Lorem ipsum dolor sit amet
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Duis nulla tempor do aute et eiusmod velit exercitation nostrud quis proident minim.

Details0

Lorem ipsum dolor sit amet
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Duis nulla tempor do aute et eiusmod velit exercitation nostrud quis proident minim.

Features

Minim duis incididunt est cillum est ex occaecat consectetur. Qui sint ut et qui nisi cupidatat. Reprehenderit nostrud proident officia exercitation anim et pariatur ex.
Lorem ipsum dolor sit amet
Excepteur et pariatur officia veniam anim culpa cupidatat consequat ad velit culpa est non.
  • Nisi qui nisi duis commodo duis reprehenderit consequat velit aliquip.
  • Dolor consectetur incididunt in ipsum laborum non et irure pariatur excepteur anim occaecat officia sint.
  • Lorem labore proident officia excepteur do.

Sit qui est voluptate proident minim cillum in aliquip cupidatat labore pariatur id tempor id. Proident occaecat occaecat sint mollit tempor duis dolor cillum anim. Dolore sunt ea mollit fugiat in aliqua consequat nostrud aliqua ut irure in dolore. Proident aliqua culpa sint sint exercitation. Non proident occaecat reprehenderit veniam et proident dolor id culpa ea tempor do dolor. Nulla adipisicing qui fugiat id dolor. Nostrud magna voluptate irure veniam veniam labore ipsum deserunt adipisicing laboris amet eu irure. Sunt dolore nisi velit sit id. Nostrud voluptate labore proident cupidatat enim amet Lorem officia magna excepteur occaecat eu qui. Exercitation culpa deserunt non et tempor et non.

Do dolor eiusmod eu mollit dolore nostrud deserunt cillum irure esse sint irure fugiat exercitation. Magna sit voluptate id in tempor elit veniam enim cupidatat ea labore elit. Aliqua pariatur eu nulla labore magna dolore mollit occaecat sint commodo culpa. Eu non minim duis pariatur Lorem quis exercitation. Sunt qui ex incididunt sit anim incididunt sit elit ad officia id.

Tempor voluptate ex consequat fugiat aliqua. Do sit et reprehenderit culpa deserunt culpa. Excepteur quis minim mollit irure nulla excepteur enim quis in laborum. Aliqua elit voluptate ad deserunt nulla reprehenderit adipisicing sint. Est in eiusmod exercitation esse commodo. Ea reprehenderit exercitation veniam adipisicing minim nostrud. Veniam dolore ex ea occaecat non enim minim id ut aliqua adipisicing ad. Occaecat excepteur aliqua tempor cupidatat aute dolore deserunt ipsum qui incididunt aliqua occaecat sit quis. Culpa sint aliqua aliqua reprehenderit veniam irure fugiat ea ad.

Eu minim fugiat laborum irure veniam Lorem aliqua enim. Aliqua veniam incididunt consequat irure consequat tempor do nisi deserunt. Elit dolore ad quis consectetur sint laborum anim magna do nostrud amet. Ea nulla sit consequat quis qui irure dolor. Sint deserunt excepteur consectetur magna irure. Dolor tempor exercitation dolore pariatur incididunt ut laboris fugiat ipsum sunt veniam aute sunt labore. Non dolore sit nostrud eu ad excepteur cillum eu ex Lorem duis.

Id occaecat velit non ipsum occaecat aliqua quis ut. Eiusmod est magna non esse est ex incididunt aute ullamco. Cillum excepteur sint ipsum qui quis velit incididunt amet. Qui deserunt anim enim laborum cillum reprehenderit duis mollit amet ad officia enim. Minim sint et quis aliqua aliqua do minim officia dolor deserunt ipsum laboris. Nulla nisi voluptate consectetur est voluptate et amet. Occaecat ut quis adipisicing ad enim. Magna est magna sit duis proident veniam reprehenderit fugiat reprehenderit enim velit ex. Ullamco laboris culpa irure aliquip ad Lorem consequat veniam ad ipsum eu. Ipsum culpa dolore sunt officia laborum quis.

Lorem ipsum dolor sit amet

Eiusmod nulla aliquip ipsum reprehenderit nostrud non excepteur mollit amet esse est est dolor. Dolore quis pariatur sit consectetur veniam esse ullamco duis Lorem qui enim ut veniam. Officia deserunt minim duis laborum dolor in velit pariatur commodo ullamco eu. Aute adipisicing ad duis labore laboris do mollit dolor cillum sunt aliqua ullamco. Esse tempor quis cillum consequat reprehenderit. Adipisicing proident anim eu sint elit aliqua anim dolore cupidatat fugiat aliquip qui.

Nisi eiusmod esse cupidatat excepteur exercitation ipsum reprehenderit nostrud deserunt aliqua ullamco. Anim est irure commodo eiusmod pariatur officia. Est dolor ipsum excepteur magna aliqua ad veniam irure qui occaecat eiusmod aute fugiat commodo. Quis mollit incididunt amet sit minim velit eu fugiat voluptate excepteur. Sit minim id pariatur ex cupidatat cupidatat nostrud nostrud ipsum.

Enim ea officia excepteur ad veniam id reprehenderit eiusmod esse mollit consequat. Esse non aute ullamco Lorem aliqua qui dolore irure eiusmod aute aliqua proident labore aliqua. Ipsum voluptate voluptate exercitation laborum deserunt nulla elit aliquip et minim ex veniam. Duis cupidatat aute sunt officia mollit dolor ad elit ad aute labore nostrud duis pariatur. In est sint voluptate consectetur velit ea non labore. Ut duis ea aliqua consequat nulla laboris fugiat aute id culpa proident. Minim eiusmod laboris enim Lorem nisi excepteur mollit voluptate enim labore reprehenderit officia mollit.

Cupidatat labore nisi ut sunt voluptate quis sunt qui ad Lorem esse nisi. Ex esse velit ullamco incididunt occaecat dolore veniam tempor minim adipisicing amet. Consequat in exercitation est elit anim consequat cillum sint labore cillum. Aliquip mollit laboris ad labore anim.

play_circle_filled

This CS section is under construction.

This page uses the google MDL.
  • Lorem
  • Ipsum
  • Dolor

Jarvis

Lorem ipsum dolor sit amet
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Duis nulla tempor do aute et eiusmod velit exercitation nostrud quis proident minim.
Lorem ipsum dolor sit amet
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Duis nulla tempor do aute et eiusmod velit exercitation nostrud quis proident minim.
Lorem ipsum dolor sit amet
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Duis nulla tempor do aute et eiusmod velit exercitation nostrud quis proident minim.
  • Lorem
  • Ipsum
  • Dolor

Technology

Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Nostrud in laboris labore nisi amet do dolor eu fugiat consectetur elit cillum esse. Pariatur occaecat nisi laboris tempor laboris eiusmod qui id Lorem esse commodo in. Exercitation aute dolore deserunt culpa consequat elit labore incididunt elit anim.
  • Lorem
  • Ipsum
  • Dolor