Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The codebase needs some simplification #138

Closed
Sothatsit opened this issue Mar 7, 2021 · 4 comments
Closed

The codebase needs some simplification #138

Sothatsit opened this issue Mar 7, 2021 · 4 comments
Labels
question Further information is requested simplification A simplification to the codebase

Comments

@Sothatsit
Copy link
Collaborator

Sothatsit commented Mar 7, 2021

In the goal of adding more and more content to the website, and improving its functionality and speed, I made a custom compile.py script to generate image resources. This started out simple enough, but it has turned into an over-complicated mess.

The compilation script currently performs all of the following:

  • Generating image resources of many sizes and formats
  • Combining and minifying JS and CSS files into smaller units
  • Generating HTML pages and doing HTML templating
  • Calculating cache times, and adding versions to URLs
  • Generating the sitemap of the website

This has turned the compile script into a 700-line, poorly organised mess. Ironically, it has turned into this in the effort of simplifying other areas of the website!

Therefore, this really needs to be improved, and I need to look into other tools that are available to take over these tasks. That way this script can be simplified once more to be easily understandable at a glance by anyone trying to understand what is going on.

Additionally, it would mean we can get rid of or at least simplify the compilation.json file greatly, as it too has become a terrifying mess. If anyone has any ideas for tools that we could use instead of our custom roll-your-own solutions, that would be great!

@Sothatsit Sothatsit added simplification A simplification to the codebase question Further information is requested labels Mar 7, 2021
@Sothatsit
Copy link
Collaborator Author

To replace the image resizing, the ImageFlow project looks like it could be really good. It allows us to dynamically resize images from request to request instead of having to do it all up front.

e.g. instead of accessing image.u_1080.png you could access image.png?width=250.

@Sothatsit
Copy link
Collaborator Author

To replace the image resizing, the ImageFlow project looks like it could be really good. It allows us to dynamically resize images from request to request instead of having to do it all up front.

ImageFlow actually seems like it is a bit over-complicated for this purpose. Also the fact that it is .NET-based and requires you to write a .NET project for the image server is not ideal... I think I will stick with our current image processing but I will try to separate the image generation code from the rest of the compilation.

Sothatsit added a commit that referenced this issue Apr 19, 2021
…based on the programming languages of each component
@Sothatsit
Copy link
Collaborator Author

Sothatsit commented Apr 19, 2021

As well as the re-organisation in f5a00f, it might be good to split up compilation.json into multiple smaller files that are also organised based on their content. This overall has the goal of making it so that if you wanted to change the source code for the rules page, all of its source code would be in the same place. Overall, I think it would make the source code simpler to understand, even if not simpler overall in terms of complexity.

@Sothatsit
Copy link
Collaborator Author

The work for this has been summed up by #167.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested simplification A simplification to the codebase
Projects
None yet
Development

No branches or pull requests

1 participant