πŸ” Alaska | Static-site Boilerplate

Open Source License: CC0-1.0 Buy me coffee

⚑ Fastest way to build HTML and CSS static sites.

You don’t have to learn complicated tools to build simple websites in a modular way.

Alaska uses efficient technology that’s similar to what you’re used to.

Technology Description
PugJS Templating tool for building HTML in a beautiful and modular way. It’s basically HTML, but modular, programmable, and without closing tags.
Sass CSS processor that extends the capabilities of current CSS.
GulpJS File processor to watch your files as you edit, reload the page on save, and build minified files.

Running Alaska

Running Alaska is quite simple. You just install all the npm dependencies and you’re good to go.

But if you need some in-depth guidance, I’ll hand it off to Poh, a friendly Polar Bear that will guide you on your journey to building in Alaska.

πŸ»β€β„οΈ LET’S GO!!!

Chill, Poh. They want instructions, not hype.

πŸ»β€β„οΈ Shut up. YOU! Let’s go…

Requirements

πŸ»β€β„οΈ If you want to do any running in Alaska, you have to prepare. And I’m not talking about warm clothes and water. I’m taking about N-P-M α΅α΅’α΅—Κ°α΅‰Κ³αΆ α΅˜αΆœα΅α΅‰Κ³`

Here’s what you need to have installed on your machine:

  • NodeJS – Click to install.
  • NPM Cli – Click to learn how to install if Node didn’t already install it.
  • Yarn (Optional) – Run: npm i -g yarn to install.
  • Gulp Cli – Run npm i -g gulp-cli to install.

πŸ»β€β„οΈ Now we need to pull all the files from Github. Go to your Projects folder cd ~/projects/ or whatever you use. Then clone the project like this:

git clone [email protected]:pixelsbyeryc/alaska.git

If you have SSH

git clone https://github.com/pixelsbyeryc/alaska.git

In case you’re cloning from HTTPS

Installing

πŸ»β€β„οΈ Now what you have the code on your computer, we’re going to install the dependencies. It’s as simple as:

yarn

If you like using yarn instead of npm, or…

npm i

If you prefer the bland outputs of npm. Your choice.

Commands

πŸ»β€β„οΈ There are two commands you can run:

yarn dev

Will watch the files for any changes and hotreload your browser.

yarn build

Will build your project under the folder /public

πŸ»β€β„οΈ Want to stop the terminal from running? Press Control+C on your terminal. It’ll stop the execution.

Build in Alaska

πŸ»β€β„οΈ To build in Alaska, you need to understand how the structure works. We like to break our food, I mean, code in small portions, you feel me?

Lemme give you the ins-and-outs of this place…

Structure

πŸ»β€β„οΈ Here’s your folder/file structure:

alaska
|   .gitignore
|   gulpfile
|   LICENSE    
β”‚   package.json
β”‚   README.md
|   yarn.lock
β”‚
└───src
β”‚   └───js
β”‚   |   β”‚   magic.js
β”‚   |   β””   ...
|   |   
β”‚   └───sass
β”‚   β”‚   |   sassy.sass
β”‚   β”‚   β””   ...
|   |   
β”‚   └───views
|       └───_data
β”‚       |   |   data.pug
β”‚       |   β””   ...
β”‚       |   
|       └───_includes
β”‚       |   |   head.pug
β”‚       |   β””   ...
β”‚       |   
|       └───components
β”‚       |   |   header.pug
β”‚       |   |   footer.pug
β”‚       |   β””   ...
β”‚       |   
|       └───layouts
β”‚       |   |   base.pug
β”‚       |   β””   ...
β”‚       |   
|       └───pages
β”‚           |   index.pug
β”‚           β””   ...
β”‚   
└───public
    β””   ...

Source Files src

πŸ»β€β„οΈ Source files are the ones you’ll be editing.

Once will you run yarn dev or yarn build, Gulp will automatically process your files and spill them into the public folder.

Public Files public

πŸ»β€β„οΈ Public files are ready for deployment.

They will have pretty and minified options for your JS and CSS files. You can also set up in your Gulpfile.js to minify your HTMLs for a slimmer code.

Views src/views

πŸ»β€β„οΈ Views folder will encompass all your Pug files β€” your HTML.

If If you need help coding in Pug, check out Poh’s Guide.

Let’s go over them:

  • Pages src/views/pages: This is where your single pages will live (eg: Home Page). You can add as many pages as you want. All of the .pug files here will be sent to the public folder.
  • Layouts src/views/layouts: Layouts are used to set up the basic structure of a page. You can re-use layouts on as many pages as you want.
  • Components src/views/components: Components help you to split up your code and make it more maintainable. You can also create components as Pug Mixins and pass data to them.
  • Includes src/views/_includes: Includes are chucks of code, much like components: they help you split up your HTML and make it more maintainable. I usually use them for things like <head> ... </head>.
  • Data src/views/_data: You can write JSON-like files with Pug and use them to iterate components so you don’t have to write the same structure over and over and over again.

Styles src/sass

πŸ»β€β„οΈ Sass folder will encompass all your Sass files β€” your CSS.

For now, we only have our sassy.sass β€” which is the main file. But we encourage you to create more files and organize them as you wish.

Note: Currently, Gulp only moves sassy.sass as sassy.css to the public folder. If you want to add another file to public, modify your Gulpfile.

If If you need help coding in Sass, check out Poh’s Guide.

Scripts src/js

πŸ»β€β„οΈ Scripts folder will encompass all your JS.

For now, we only have one file called magic.js. You can create as many files as you want.

Note: Currently, Gulp only moves magic.js to the public folder. If you want to add another js file to public, modify your Gulpfile.

Gulpfile

πŸ»β€β„οΈ Gulpfile uses functions to process specific files.

I’m lazy to keep writing this doc right now, so here’s the file: gulpfile.js. Check it out.

Coding with Poh πŸ»β€β„οΈ

πŸ»β€β„οΈ Coming soon!

Poh’s Guide to Pug

πŸ»β€β„οΈ Coming soon!

Here’s a preview of how a Pug file turns into an HTML file:

file.pug

body.class
    header.header
        nav.nav-links
            a(href="/", target="_blank") Link Text

    main.main
        section.section
            h1.heading.--huge Page Title
            p This is a paragraph.

file.html

<body class="class">
    <header class="header">
        <nav class="nav-links">
            <a href="/" target="_blank">
                Link Text
            </a>
        </nav>
    </header>
    <main class="main">
        <section class="section">
            <h1 class="heading --huge">
                Title
            </h1>
            <p> This is a paragraph.
        </section>
    </main>
</body>

Poh’s Guide to Sass

πŸ»β€β„οΈ Coming soon!

License

😝 License to do whatever ᡗʰᡉ ᢠᡘᢜᡏ you want. Go nuts.

cc-0

GitHub

View Github