Git Product home page Git Product logo

Miayam

The Brutalist Blog Site Built & Designed By Muhamad D. R.

Netlify Status

A blog site to store thoughts and ideas. Built and designed solely by yours truly. It stays true to itself. An entity that is an inhabitant of the web. HTML, CSS, JavaScript, and everything in between bundled together. It's ugly, brutal, a dead simple site, a sore to the eyes, but having no more than is really needed.

https://miayam.io

Table of Contents

Introduction

A starter project to rebuild miayam.github.io from the ground up using Eleventy and friends. It is a foundation on which new miayam.io will be built. Removing Jekyll entirely from the code base πŸ’©.

What do I need more of in a brutalist website?

  • A simple design, component based design that's easy to change and work with. It doesn't have to be React, Angular, Vue or Svelte
  • Performance. A super fast jellyfish. 100% lighthouse score
  • SEO

Therefore, this starter project must be:

Boring

I believe in boring technology. Shiny new technology will be obselete in no time, but boring tech will not. Pug for building presentational component. SCSS for styling. Vanilla JS for manipulating the DOM, scripting repetitive tasks, and configuration.

Atomic

Atomic Design is a way to go. It makes the design modular that can be easily managed and updated. Thanks to Daniel Tonon for this great article. He encourages us to combine modified BEM naming convention with atomic design methodology. He also wrote pros and cons for his approach and let us decide and manage the trade-off.

Here's the file structure:

src
└── components 
    β”œβ”€β”€ atoms
    |    └── button
    |       β”œβ”€β”€ index.pug
    |       β”œβ”€β”€ _index.scss
    |       └── index.js
    |── molecules
    |── organisms
    └── templates

components is an entry point in which Eleventy looks for layouts.

As Few Assets As Possible

Webpack is a bundle manager for this project. Any changes to components/templates/**/*/index.js or components/templates/**/*/_index.scss is watched and rebuilt by Webpack. Webpack bundles JavaScript and SCSS code in multiple entry points reside in components/templates which will be injected on every template by HtmlWebpackPlugin. Eleventy will do the rest.

Here's the file structure:

src
└── components 
    β”œβ”€β”€ atoms
    β”œβ”€β”€ molecules
    β”œβ”€β”€ organisms
    └── templates
         β”œβ”€β”€ base
         |  └── index.pug
         β”œβ”€β”€ 404
         |  β”œβ”€β”€ index.pug
         |  β”œβ”€β”€ _index.scss
         |  └── index.js
         └── home
            β”œβ”€β”€ index.pug
            β”œβ”€β”€ _index.scss
            └── index.js

Here's the snippet from webpack.common.js:

const ENTRY_POINTS = [
    'home',
    '404'
];

const multipleHtmlPlugins = ENTRY_POINTS.map(name => {
    return new HtmlWebpackPlugin({
        template: `${basePath}/components/templates/base/index.pug`,
        filename: `${basePath}/components/templates/${name}/index.pug`,
        chunks: [`${name}`],
        inject: false,
        hash: true
    });
});

module.exports = {
    entry: ENTRY_POINTS.reduce((prev, curr) => {
        return {
            ...prev,
            [curr]: `./src/components/templates/${curr}/index.js`
        }
    }, {}),
    plugins: [
        ...multipleHtmlPlugins
        ... // The rest.
    ]
    ... // The rest
};

Here's how we inject assets on base template (components/templates/base/index.pug):

body
    //- Inject assets. 6 spaces is necessary, so that `HtmlWebpackPugPlugin` can
    //- translate this snippet to proper pug syntax.
    <%= htmlWebpackPlugin.files.css.map((css) => {
        return `link(href=\'${css}\', rel='stylesheet')`).join('\n      ');
    }) %>
    <%= htmlWebpackPlugin.files.js.map((js) => {
        return `script(src=\'${js}\', type='text/javascript', async)`).join('\n      ');
    }) %>

As a result, each template will have distinct minified, production-ready assets that are only required by pages that include it. The assets required by the Home page will not be loaded by the About page. As few assets as possible.

Usage

Requirement

You must install volta. You will be using Node.js version 12.18.4.

Run this command to make sure volta can detect package.json:

$ source ~/.bashrc

Development

Install all dependencies:

$ npm install

After that, run this command:

$ npm run start

Webpack bundles the assets, Eleventy will do the rest.

Open localhost:1992 to see the result.

Production

To build production-ready bundle, run this command:

$ npm run build

You can host it on Github Pages, Netlify, or else.

Special Thanks

The Reason Why I Migrate From Jekyll To Eleventy

At first,Β miayam.ioΒ was a personal blog site built withΒ Jekyll using a theme I picked carelessly without thinking. Two years later, I almost forgot half of the code. Ruby seemed foreign to me. The more I tinkered with it, the more befuddled I was. So, I decided to burn it down and rebuild it from the ground up.

I was looking for an alternative toΒ JekyllΒ written inΒ JavaScriptΒ because I am a boring web developerβ€”the kind you canΒ find anywhere else. IΒ triedΒ GatsbyΒ and wound up getting bored. All those shiny new technologies GatsbyΒ has to offer were not really what I need. I triedΒ Hexo. It had a similar ambiance to JekyllΒ but it didn't spark joy.

And then, there wasΒ Eleventy.

It really was like a magical glove that just fit my brain perfectly. It did one thing, and did it well. A simple SSG (Static Site Generator) that helped provide the barebones of the next generation of miayam.io. And for good reason, the batteries were not included.

Muhamad D. R.'s Projects

cms icon cms

A headless CMS built with WordPress.

cs-intro icon cs-intro

The summary of Complete Intro To Computer Science by Brian Holt.

js30 icon js30

30 day JavaScript challenge

miayam icon miayam

The brutalist blog site built & designed by Muhamad D. R.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.