Skip to content

Commit

Permalink
feat: upgraded to phel 0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mabasic committed Sep 2, 2023
1 parent aa9965f commit 540afb8
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 80 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"php": "^8.1",
"aws/aws-sdk-php": "^3.279",
"erusev/parsedown-extra": "^0.8.1",
"phel-lang/phel-lang": "v0.8.0",
"phel-lang/phel-lang": "v0.11.0",
"rakibtg/sleekdb": "^2.15",
"spatie/yaml-front-matter": "^2.0",
"vlucas/phpdotenv": "^5.5"
Expand Down
30 changes: 18 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ After being happy for a long time with this website, a few things started bother

## 1. 80kb JS for mobile menu hamburger and menu dropdowns

I was loading Bootstrap JS file which was 80kb heavy, just so that the dropdown menu would appear and that you can see the menu on mobile devices. I wrote a few lines of vanilla JS to solve this. This lead to another thing. I no longed needed roolup for. I did not need it in the first place, but for sure I don't need it now. The JS code now is 4kb in size.
I was loading Bootstrap JS file which was 80kb heavy, just so that the dropdown menu would appear and that you can see the menu on mobile devices. I wrote a few lines of vanilla JS to solve this. This lead to another thing. I no longed needed rollup for this. I did not need it in the first place, but for sure I don't need it now. The JS code now is 4kb in size.

## 2. 200kb for Bootstrap/CSS

Again, I was loading the entire Boostrap scss. After some research I found that I can only include parts of bootstrap that I use. This cut down 50kb in size.

I was considering rewrite the entire style in tailwind, but that would take me a long time, so I decided to work with what was already here.

Because of the size of bootstrap I don't think that I will be using it again in my projects, but I find it to be very good in terms of having a base layer on which you can build upon.
Again, I was loading the entire Boostrap scss. After some research I found that I can only include parts of bootstrap that I use. This cut down 50kb in size. I was considering rewrite the entire style in tailwind, but that would take me a long time, so I decided to work with what was already here. Because of the size of bootstrap I don't think that I will be using it again in my projects, but I find it to be very good in terms of having a base layer on which you can build upon.

### Linting

Expand Down
42 changes: 20 additions & 22 deletions phel-config.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
<?php

return [
'src-dirs' => ['src'],
'test-dirs' => ['tests'],
'out-dir' => 'out'
];
// return [
// 'src-dirs' => ['src'],
// 'test-dirs' => ['tests'],
// 'out-dir' => 'out'
// ];

// NOTE: Phel 0.10+ does not work.
declare(strict_types=1);

// declare(strict_types=1);
use Phel\Config\PhelConfig;
use Phel\Config\PhelOutConfig;

// use Phel\Config\PhelConfig;
// use Phel\Config\PhelOutConfig;

// return (new PhelConfig())
// ->setSrcDirs(['src'])
// ->setTestDirs(['tests'])
// ->setOut(
// (new PhelOutConfig())
// ->setDestDir('out')
// ->setMainPhelNamespace('app\boot')
// ->setMainPhpFilename('index')
// )
// ->setFormatDirs(['src', 'tests'])
// ->setIgnoreWhenBuilding(['local.phel'])
// ->setKeepGeneratedTempFiles(false);
return (new PhelConfig())
->setSrcDirs(['src'])
->setTestDirs(['tests'])
->setOut(
(new PhelOutConfig())
->setDestDir('out')
->setMainPhelNamespace('app\boot')
->setMainPhpFilename('index')
)
->setFormatDirs(['src', 'tests'])
->setIgnoreWhenBuilding(['local.phel'])
->setKeepGeneratedTempFiles(false);
52 changes: 26 additions & 26 deletions src/projects/index.phel
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
(ns app\projects\index
(:require app\projects\year-2023)
(:require app\projects\year-2022)
(:require app\projects\year-2021)
(:require app\projects\year-2020)
(:require app\projects\year-2019)
(:require app\projects\year-2018)
(:require app\projects\year-2017)
(:require app\projects\year-2016)
(:require app\projects\year-2015)
(:require app\projects\year-2014)
(:require app\projects\year-2013)
(:require app\projects\year-2012)
(:require app\projects\year-2011))
(:require app\projects\year-2023-tmp-fix)
(:require app\projects\year-2022-tmp-fix)
(:require app\projects\year-2021-tmp-fix)
(:require app\projects\year-2020-tmp-fix)
(:require app\projects\year-2019-tmp-fix)
(:require app\projects\year-2018-tmp-fix)
(:require app\projects\year-2017-tmp-fix)
(:require app\projects\year-2016-tmp-fix)
(:require app\projects\year-2015-tmp-fix)
(:require app\projects\year-2014-tmp-fix)
(:require app\projects\year-2013-tmp-fix)
(:require app\projects\year-2012-tmp-fix)
(:require app\projects\year-2011-tmp-fix))

(def index
[{:year "2023" :projects year-2023/index}
{:year "2022" :projects year-2022/index}
{:year "2021" :projects year-2021/index}
{:year "2020" :projects year-2020/index}
{:year "2019" :projects year-2019/index}
{:year "2018" :projects year-2018/index}
{:year "2017" :projects year-2017/index}
{:year "2016" :projects year-2016/index}
{:year "2015" :projects year-2015/index}
{:year "2014" :projects year-2014/index}
{:year "2013" :projects year-2013/index}
{:year "2012" :projects year-2012/index}
{:year "2011" :projects year-2011/index}])
[{:year "2023" :projects year-2023-tmp-fix/index}
{:year "2022" :projects year-2022-tmp-fix/index}
{:year "2021" :projects year-2021-tmp-fix/index}
{:year "2020" :projects year-2020-tmp-fix/index}
{:year "2019" :projects year-2019-tmp-fix/index}
{:year "2018" :projects year-2018-tmp-fix/index}
{:year "2017" :projects year-2017-tmp-fix/index}
{:year "2016" :projects year-2016-tmp-fix/index}
{:year "2015" :projects year-2015-tmp-fix/index}
{:year "2014" :projects year-2014-tmp-fix/index}
{:year "2013" :projects year-2013-tmp-fix/index}
{:year "2012" :projects year-2012-tmp-fix/index}
{:year "2011" :projects year-2011-tmp-fix/index}])
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2011
(ns app\projects\year-2011-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2012
(ns app\projects\year-2012-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2013
(ns app\projects\year-2013-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2014
(ns app\projects\year-2014-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2015
(ns app\projects\year-2015-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2016
(ns app\projects\year-2016-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2017
(ns app\projects\year-2017-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2018
(ns app\projects\year-2018-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2019
(ns app\projects\year-2019-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2020
(ns app\projects\year-2020-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2021
(ns app\projects\year-2021-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2022
(ns app\projects\year-2022-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns app\projects\year-2023
(ns app\projects\year-2023-tmp-fix
(:require app\projects\project :refer [project]))

(def index
Expand Down

0 comments on commit 540afb8

Please sign in to comment.