~mika/www.m1kadev.nl

03282dba0228b4270a1aba844de91df350e2e714 — m1kadev 7 months ago 9b2644c
ADD FXG INTEGRATIONNNN
3 files changed, 68 insertions(+), 70 deletions(-)

M build.exs
A src/index.fxg
R src/{index => template}.html
M build.exs => build.exs +47 -44
@@ 6,52 6,61 @@ Mix.install([

require EEx

# hello

Calendar.put_time_zone_database(Tzdata.TimeZoneDatabase)

defmodule Builders do
  binfo_template = """
  commit=<%= commit %>
  lightningcss=<%= lightningcss %>
  html_minifer_next=<%= html_minifier_next %>
  uglifyjs=<%= uglifyjs %>
  build_time=<%= build_time %>
  commit=<%= commit %>lightningcss=<%= lightningcss %>html_minifer_next=<%= html_minifier_next %>uglifyjs=<%= uglifyjs %>build_time=<%= build_time %>
  """

  def html(input_path) do
    output_path = String.replace_prefix(input_path, "src", "build")

    System.cmd("html-minifier-next", [
      "--preset",
      "conservative",
      "-o",
      output_path,
      input_path
    ])
    {_, 0} =
      System.cmd("html-minifier-next", [
        "--preset",
        "conservative",
        "-o",
        output_path,
        input_path
      ])
  end

  def css(input_path) do
    output_path = String.replace_prefix(input_path, "src", "build")

    System.cmd("lightningcss", [
      "-m",
      "-o",
      output_path,
      input_path
    ])
    {_, 0} =
      System.cmd("lightningcss", [
        "-m",
        "-o",
        output_path,
        input_path
      ])
  end

  def js(input_path) do
    output_path = String.replace_prefix(input_path, "src", "build")

    System.cmd("uglifyjs", [
      "-c",
      "-o",
      output_path,
      input_path
    ])
    {_, 0} =
      System.cmd("uglifyjs", [
        "-c",
        "-o",
        output_path,
        input_path
      ])
  end

  # TODO: js support :)
  def fxg(input_path, template) do
    output_path =
      String.replace_prefix(input_path, "src", "build")
      |> String.replace_suffix("fxg", "html")

    {output, 0} = System.cmd("fxg", [input_path])
    output = String.replace(template, "<fxg-content />", output)
    File.write(output_path, output)
  end

  EEx.function_from_string(
    :def,


@@ 67,25 76,13 @@ defmodule Builders do
  )
end

commit =
  System.cmd("git", ["rev-parse", "HEAD"])
  |> elem(0)
  |> String.trim()
{commit, 0} = System.cmd("lightningcss", ["-V"])

lightningcss =
  System.cmd("lightningcss", ["-V"])
  |> elem(0)
  |> String.trim()
{lightningcss, 0} = System.cmd("lightningcss", ["-V"])

html_minifier_next =
  System.cmd("html-minifier-next", ["-V"])
  |> elem(0)
  |> String.trim()
{html_minifier_next, 0} = System.cmd("html-minifier-next", ["-V"])

uglifyjs =
  System.cmd("uglifyjs", ["-V"])
  |> elem(0)
  |> String.trim()
{uglifyjs, 0} = System.cmd("uglifyjs", ["-V"])

File.rm_rf("build")



@@ 94,9 91,11 @@ case File.mkdir_p("build/static") do
  _ -> raise "Couldn't create the build file structure (/build/static)"
end

Path.wildcard("src/**/*.html")
|> Task.async_stream(fn file -> Builders.html(file) end)
|> Enum.to_list()
# Path.wildcard("src/**/*.html")
# |> Task.async_stream(fn file -> Builders.html(file) end)
# |> Enum.to_list()

{:ok, main_template} = File.read("src/template.html")

Path.wildcard("src/**/*.css")
|> Task.async_stream(fn file -> Builders.css(file) end)


@@ 106,6 105,10 @@ Path.wildcard("src/**/*.js")
|> Task.async_stream(fn file -> Builders.js(file) end)
|> Enum.to_list()

Path.wildcard("src/**/*.fxg")
|> Task.async_stream(fn file -> Builders.fxg(file, main_template) end)
|> Enum.to_list()

Path.wildcard("static/**/*")
|> Task.async_stream(fn file -> File.cp(file, "build/" <> file) end)
|> Enum.to_list()

A src/index.fxg => src/index.fxg +18 -0
@@ 0,0 1,18 @@
= haii :3 i'm mika =

haiii!!! i'm mika (also //m1ka//, //m1kadev//). i'm a (mostly backend) developer from <#https://en.wikipedia.org/wiki/Nederland The Netherlands>. i'm also a big fan of making drinks & cooking.

=== about me ===

i do VWO (dutch A-levels) phyiscs in the greater rotterdam area. i've been working on <#https://www.github.com/m1kadev/fxg fxg>, a markup language written in <#https://rust-lang.org/ Rust>. also, i've been playing around with functional programming (mostly in <#https://elixir-lang.org Elixir>).

Together with 3 other friends, we run <#https://dupunkto.org/ {du}punkto>

=== contact ===
feel free to reach out to me! you can reach me at m1kadev on <#https://discord.com/ discord>, or on my email address at

<rust>
format!("{2}@{0}.{1}", "dupunkto", "org", "mika")
</>

this code is to filter out all non-<>format!</> users
\ No newline at end of file

R src/index.html => src/template.html +3 -26
@@ 16,36 16,13 @@
        <h3>.nl</h3>
        <h1>m1kadev</h1>
        <nav>
            <a href="/">home</a><a href="/">pictures or sumn</a>
            <a href="/">home</a>
            <a href="/projects">projects</a>
        </nav>
    </div>
    <div id="content">
        <main>
            <h1>Haii :3 i'm mika</h1>
            <p>
                haiii!!! i'm mika (also <em>m1ka</em>, <em>m1kadev</em>). i'm a (mostly backend) developer from <a
                    href="https://en.wikipedia.org/wiki/Netherlands">The Netherlands</a>. i'm also a big fan of making
                drinks & cooking.
            </p>
            <h3>about me</h3>
            <p>
                i do VWO (dutch A-levels) phyiscs in the greater rotterdam area. i've been working on <a
                    href="https://github.com/m1kadev/fxg">fxg</a>, a markup language written in <a
                    href="https://rust-lang.com">rust</a>. also, i've been playing around with functional programming
                (mostly in <a href="https://elixir-lang.org/">elixir</a>).
            </p>
            <p>
                Together with 3 other friends, we run <a href="https://dupunkto.org/">{du}punkto</a>.
            </p>
            <h3>contact</h3>
            <p>
                feel free to reach out to me! you can reach me at m1kadev on <a href="https://discord.com/">discord</a>,
                or on my email address at
            </p>
            <pre><code class="language-rust">
format!("{2}@{0}.{1}", "dupunkto", "org", "mika")
            </code></pre>
            <small>this code is to filter out all non-<code>format!</code> users</small>
            <fxg-content />
            <hr>
            <footer>
                <div id="metadata">