π
Alaska | Static-site Boilerplate
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. |
Contents
- Running Alaska
- Build in Alaska
- Coding with Poh
π»ββοΈ - License (Read carefully)
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 foldercd ~/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 ourfood, 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
β ...
src
Source Files
π»ββοΈ
Source files are the ones you'll be editing.Once will you run
yarn dev
oryarn build
, Gulp will automatically process your files and spill them into thepublic
folder.
public
Public Files
π»ββοΈ
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.
src/views
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 thepublic
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.
src/sass
Styles
π»ββοΈ
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
assassy.css
to thepublic
folder. If you want to add another file topublic
, modify your Gulpfile.If If you need help coding in Sass, check out Poh's Guide.
src/js
Scripts
π»ββοΈ
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 thepublic
folder. If you want to add another js file topublic
, 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
α΅Κ°α΅ αΆ α΅αΆα΅ you want. Go nuts.