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.
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
orSvelte
- Performance. A super fast jellyfish. 100% lighthouse score
- SEO
Therefore, this starter project must be:
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 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.
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.
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
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.
To build production-ready bundle, run this command:
$ npm run build
You can host it on Github Pages
, Netlify
, or else.
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.