refactor: move CSS and JS assets to directory in project root (#72)

In this PR we move all of the CSS and JavaScript assets from the public assets directory to a new directory in the project root. The main reason for this is that I would like to believe this makes them easier to find. Since all CSS and JS is bundled with each page anyways there is no need to access these directly from a public directory. The main argument against this I think would be "transparency". We already run this site with `display_php_source=true` in Vegvisir (so page source code can be inspected by appending `.php` to the end of a url. But there is of course no reason to trust that it's the actual source code.

Reviewed-on: https://codeberg.org/vlw/vlw.se/pulls/72
This commit is contained in:
Victor Westerlund 2026-04-05 12:18:10 +02:00
parent eeaaeeecdd
commit 55a8234800
33 changed files with 18 additions and 18 deletions

View file

@ -55,7 +55,7 @@
}; };
?> ?>
<?= VV::css("public/assets/css/pages/about") ?> <?= VV::css("assets/css/pages/about") ?>
<section class="intro"> <section class="intro">
<h2 aria-hidden="true">Hi, I'm</h2> <h2 aria-hidden="true">Hi, I'm</h2>
<h1>Victor Westerlund</h1> <h1>Victor Westerlund</h1>
@ -143,4 +143,4 @@
<p>RFC&nbsp;3339</p> <p>RFC&nbsp;3339</p>
<p>digital archiving</p> <p>digital archiving</p>
</div> </div>
<?= VV::js("public/assets/js/pages/about") ?> <?= VV::js("assets/js/pages/about") ?>

View file

@ -37,7 +37,7 @@
} }
?> ?>
<?= VV::css("public/assets/css/pages/contact") ?> <?= VV::css("assets/css/pages/contact") ?>
<section> <section>
<h1>Let's chat!</h1> <h1>Let's chat!</h1>
<p>The best way to get in touch is definitely by email, or through the form on this page. The time in Sweden is <i><?= $date->format("h:i a") ?></i> right now, I am currently <?= $date->is_available() ? "available" : "not available" ?> and will hopefully reply in about <?= $date->get_estimated_reply_hours() ?> hours.</p> <p>The best way to get in touch is definitely by email, or through the form on this page. The time in Sweden is <i><?= $date->format("h:i a") ?></i> right now, I am currently <?= $date->is_available() ? "available" : "not available" ?> and will hopefully reply in about <?= $date->get_estimated_reply_hours() ?> hours.</p>
@ -112,4 +112,4 @@
</button> </button>
</form> </form>
</section> </section>
<?= VV::js("public/assets/js/pages/contact") ?> <?= VV::js("assets/js/pages/contact") ?>

View file

@ -1,6 +1,6 @@
<?= VV::css("public/assets/css/pages/error") ?> <?= VV::css("assets/css/pages/error") ?>
<canvas></canvas> <canvas></canvas>
<section class="error"> <section class="error">
<h1 glitch-text><span>4</span><span>0</span><span>4</span></h1> <h1 glitch-text><span>4</span><span>0</span><span>4</span></h1>
</section> </section>
<script type="module"><?= VV::js("public/assets/js/pages/error") ?> <script type="module"><?= VV::js("assets/js/pages/error") ?>

View file

@ -7,7 +7,7 @@
} }
?> ?>
<?= VV::css("public/assets/css/pages/index") ?> <?= VV::css("assets/css/pages/index") ?>
<div class="menu"> <div class="menu">
<?= VV::embed("public/assets/media/line.svg") ?> <?= VV::embed("public/assets/media/line.svg") ?>
<menu> <menu>
@ -23,4 +23,4 @@
</div> </div>
<img src="/assets/media/gazing.jpg" alt="A portrait of Victor with a pair of cartoon glasses drawn in the shape of two V's over his eyes"/> <img src="/assets/media/gazing.jpg" alt="A portrait of Victor with a pair of cartoon glasses drawn in the shape of two V's over his eyes"/>
<?= VV::js("public/assets/js/pages/index") ?> <?= VV::js("assets/js/pages/index") ?>

View file

@ -22,7 +22,7 @@
} }
?> ?>
<?= VV::css("public/assets/css/pages/search") ?> <?= VV::css("assets/css/pages/search") ?>
<section class="search"> <section class="search">
<form> <form>
<input name="<?= GET_KEY_QUERY ?>" type="search" placeholder="search vlw.se..." value="<?= $search->query ?>"> <input name="<?= GET_KEY_QUERY ?>" type="search" placeholder="search vlw.se..." value="<?= $search->query ?>">
@ -105,4 +105,4 @@
<p>Start typing to search</p> <p>Start typing to search</p>
</section> </section>
<?php endif; ?> <?php endif; ?>
<?= VV::js("public/assets/js/pages/search") ?> <?= VV::js("assets/js/pages/search") ?>

View file

@ -37,8 +37,8 @@
//--><!]]> //--><!]]>
</script> </script>
<?= VV::css("public/assets/css/fonts") ?> <?= VV::css("assets/css/fonts") ?>
<?= VV::css("public/assets/css/shell") ?> <?= VV::css("assets/css/shell") ?>
<title>Victor Westerlund</title> <title>Victor Westerlund</title>
<link rel="icon" href="/assets/media/vw.svg"/> <link rel="icon" href="/assets/media/vw.svg"/>
@ -82,6 +82,6 @@
</div> </div>
</search-results> </search-results>
<?= VV::js("public/assets/js/shell") ?> <?= VV::js("assets/js/shell") ?>
</body> </body>
</html> </html>

View file

@ -1,4 +1,4 @@
<?= VV::css("public/assets/css/pages/work/archive") ?> <?= VV::css("assets/css/pages/work/archive") ?>
<section> <section>
<h1>This is an archived website!</h1> <h1>This is an archived website!</h1>
<p>You're about to view an archived version of this website on my domain. Everything you see, and all features that are available on the archived website have been recreated to simulate the real behavior as closely as possible. Some features can unfortunately not be simulated properly and have been disabled completely. No actions you take on this website have any real effects.</p> <p>You're about to view an archived version of this website on my domain. Everything you see, and all features that are available on the archived website have been recreated to simulate the real behavior as closely as possible. Some features can unfortunately not be simulated properly and have been disabled completely. No actions you take on this website have any real effects.</p>
@ -9,4 +9,4 @@
<?= VV::embed("public/assets/media/icons/chevron.svg") ?> <?= VV::embed("public/assets/media/icons/chevron.svg") ?>
</button></a> </button></a>
</section> </section>
<?= VV::js("public/assets/js/pages/work/archive") ?> <?= VV::js("assets/js/pages/work/archive") ?>

View file

@ -5,7 +5,7 @@
require_once VV::root("src/Database/Models/Work/Work.php"); require_once VV::root("src/Database/Models/Work/Work.php");
?> ?>
<?= VV::css("public/assets/css/pages/work/index") ?> <?= VV::css("assets/css/pages/work/index") ?>
<section class="hero"> <section class="hero">
<div class="item vegvisir"> <div class="item vegvisir">
<div class="wrapper"> <div class="wrapper">

View file

@ -42,7 +42,7 @@
} }
?> ?>
<?= VV::css("public/assets/css/pages/work/timeline") ?> <?= VV::css("assets/css/pages/work/timeline") ?>
<section class="git"> <section class="git">
<?= VV::embed("public/assets/media/icons/codeberg.svg") ?> <?= VV::embed("public/assets/media/icons/codeberg.svg") ?>
<p>This timeline has most but not all of my FOSS software. If you want to see a list of all things I've created for the free software world, check out my repos on Codeberg or Forgejo.</p> <p>This timeline has most but not all of my FOSS software. If you want to see a list of all things I've created for the free software world, check out my repos on Codeberg or Forgejo.</p>

View file

@ -1,4 +1,4 @@
<?= VV::css("public/assets/css/pages/work/wip") ?> <?= VV::css("assets/css/pages/work/wip") ?>
<section class="disclaimer"> <section class="disclaimer">
<h1>Soon, very soon!</h1> <h1>Soon, very soon!</h1>
<p>Bear with me as I cook up some texts about this project! Hopefully with some pictures too.</p> <p>Bear with me as I cook up some texts about this project! Hopefully with some pictures too.</p>