-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
204 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[editor] | ||
auto-format = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: "Initial Commit" | ||
author: "Mario Bašić" | ||
date: "2021-03-21" | ||
excerpt: "This blog post contains what was previously written in the README.md." | ||
--- | ||
|
||
My initial idea was to use Phel on the backend and Rescript on the frontend. I tried to build the backend to match the previous website (n6) which was built with Laravel. Routing, global middleware, validation, logging, mail, CSRF protection, configs, partials and layouts are all inspired by Laravel. **It took me around 14 days to complete this website (3-6.3.2021 to 20-21.3.2021).** Since I spent a whole bunch of time implementing backend features, when I came to the point of dealing with Javascript I decided to stick to the already existing javascript code from the previous website, but with improvements to the tooling (prettier, eslint, webpack, babel, prop-types) and data handling. I still want to switch from Javascript to something else, but that will probably have to be in the future. Recently, I have started learning about F# and Fable/Feliz and that got me questioning using Rescript on the frontend. Also there are other options like Elm or Dart. ~~Can't really decide.~~ _Decided to go with F#/Fable. See update bellow for more details._ | ||
|
||
## Phel-lang | ||
|
||
Working with Phel was very fun and an interesting mind flex. The concept that code is data is mind blowing. This is my first encounter with a lisp inspired language and a functional language. The language has everything needed for rapid development. The language comes with support for the whole PHP ecosystem. It has testing and formatting integrated, and comes with a REPL in which one can quickly prototype functions. The only downside to the language at this point is its speed. I haven't done any concrete metrics, but when you visit the website you will feel the load times. I have talked with the language author and he knows about the issue and is working on a "compile" feature which will make the language as fast as PHP itself. Considering that the language is version 0.2.0, I can't wait for it to reach a stable release. | ||
|
||
## F#/Fable | ||
|
||
Originally I have wanted my first F# project to be a backend project, like a simple API or something, but since I wanted to replace Javascript with something I gave F# a chance. I do not regret it. The language is very beautiful. It's syntax is similar to LISP at times. It's immutable but can be mutable, it's functional but can be object oriented, it's strongly typed but most of the times it feels like a dynamic language because of type inference, it's what almost every new language these days wants to be, but is actually around 10 years old. A gem. Writing F# is fun and different than writing JS. Most of the time I was in my code editor, "adjusting" types and making the compiler happy. I would open the browser just to verify that it works after evertyhing compiles. When in case of JS I would write a line of code and then refresh the page in the browser to make sure that it runs or that I gave the correct parameter to a function etc. Maybe this is why Typescript is so loved these days. | ||
|
||
## Future improvements | ||
|
||
In the future I plan on adding missing tests and replacing Javascript with something else. Initially, I have started with simple tests for pages and partials, but then I got busy with implementing features and finishing the website, so the tests fell behind. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
title: "Update: F#/Fable" | ||
author: "Mario Bašić" | ||
date: "2021-04-27" | ||
excerpt: "I've rewritten Javascript with F#/Fable." | ||
--- | ||
|
||
I've rewritten Javascript with F#/Fable. After reading about F# and F#/Fable, comparing it with Rescript and Elm, and trying to find a project to experiment with it I have decided to use Fable and write Javascript with F#. My goal was to go all in and not write a single line of javascript. **It is all F# now 100%.** The code that I wrote follows the same structure as the JS code as much as possible. This was my plan so that it is easier for me to view differences. Parts of code could have been written better if I did not follow the code structure from JS as much. | ||
|
||
Since I was/am new to the language I had to figure out a lot of stuff including the tooling, the ecosystem, the syntax, the libraries. The documentation for Fable could be better. There are so many options for everything. I had to find a React library, a JSON library and figure out how to do HTTP requests. There were times where I almost gave up on the F#/Fable rewrite. | ||
|
||
~~For archive purposes I've kept the original JS files in the source code so that I can compare the syntax and code in the future.~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: "Update: New Blog" | ||
author: "Mario Bašić" | ||
date: "2021-05-24" | ||
excerpt: "I've moved my blog from Gatsby.js to this website." | ||
--- | ||
|
||
I've moved my blog from Gatsby.js to this website. In order to achive this I had to implement named route paramaters in the router, implement reading front matter/markdown from files and converting to html, implement better active route detection (laravelista/Ekko logic) and other related stuff. The whole process was simple, but I had to deal with regex and that was painful. Every time I have to lookup what each symbol means. I have added a bunch of tests and updated the application to Phel 0.3.2 which bring new data structures and fixes. |
10 changes: 10 additions & 0 deletions
10
content/posts/2022-07-23-update-removed-webpack-and-fsharp-fable.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: "Update: Removed webpack and F#/Fable" | ||
author: "Mario Bašić" | ||
date: "2022-07-23" | ||
excerpt: "I used F# to build the contact form on the start page because I wanted to try F#." | ||
--- | ||
|
||
I used F# to build the contact form on the start page because I wanted to try F#. Since then I have started using F# whenever I can. My goal is to make a simple contact form with no JS. Phel renders html form, form submits and the user gets the response as html. Because of that I am removing F# from this repository. I have made a new tag called `fsharp-fable-start` where you can view the last working version of F#/Fable start page form. | ||
|
||
Because of this I have moved away from webpack to using rollup for js and sass for css. I think that this is very simple now to maintain and there are no hacks involved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.