Use Jinja and Frozen Flask to build a high performance static website
Tanay PrabhuDesai (~tanay) |
A lot of front-end developers try to optimize their websites and try to make them feel more performant by reducing the page load time. With a completely new and a different perspective towards blog or a static website generation, this talk focuses on having your own website generator that optimizes the load time of the website that you are building. In addition to that, it will be more applicable if your website has the continuous addition of content, like a blog or an online e-book website.
Outline of the talk
- Metrics for a high-performance website Different metrics like text minification and image compression will be discussed on the basis of which one can optimize the website
- Existing static blog generators There are many static website generators like Jekyll which are very powerful and the most of which use markdown for generating web pages
- Jinja for writing web pages Jinja helps us generating custom web pages based on some template and can also help us write components to which we can pass data from our Python code
- Using Frozen-Flask for rendering HTML pages Details about Frozen-Flask and what exactly it does. This section will also discuss how Frozen-Flask can be used for building high-performance website.
- Optimizing images by automatically compressing them Using different Python image processing libraries that have an image compressing ability, in order to compress the images that will be served.
- Minifying the files and combining them into a single file Again, using different Python minification libraries for minification of HTML, JS, CSS in order to perform minification so that a minified file can be served.
Most of the things mentioned above like optimizations will be done by using different Python tools and libraries. A combination of these tools and libraries together form a custom toolchain for your website generator. This has a very good impact on how you are making the website while giving you a 'Do It Yourself' feel. While in comparison with more popular static website generators, this talk will discuss more things about using Frozen-Flask in place of the traditional website generator.
Unlike using Jinja and Flask to write server side web pages, Frozen-Flask allows us to generate a static website from the endpoint routes that are given to Flask. The resultant build that you get can be hosted anywhere for a very cheap cost even on something like Amazon S3. Most of the existing static website generators use Markdown for the website generation. The talk will discuss the advantages and disadvantages of using Markdown vs using Jinja for your website generator. Also, this will discuss different features of Jinja templating engine and how those features give an additional leverage while writing your own website.
Last but not the least, this talk will cover different libraries which when used in combination with each other will form an automated toolchain which will do all the optimization and the necessary processing for the generation of the web pages. The processing can be something very basic as in passing data to the Jinja templates in order to generate the necessary HTML files. The optimization will consist of things like using Python image processing libraries and minification libraries to compress the images and to minify the parseable text files that will be served as your web page.
This talk requires a decent knowledge of Python, Flask and Jinja, and also good knowledge of HTML and making simple web pages. Knowledge about Frozen-Flask will be helpful but is not necessary.
Right from a very young age, I was interested in programming and wanted to be a software engineer. I then started to learn to program with a strong passion on my own when I joined a diploma course even before it was taught academically. I also work on a lot of personal projects which I think that helps me learn a lot of things on my own. I am a strong lover and an advocate of test driven development and use it almost always while developing software. I like to see the mistakes done by me, and the mistakes that are done by the other developers and learn from those mistakes which can help me write better quality software. I am primarily a Python developer and have work experience in the industry with technologies like Flask work on a full stack application. The other things that I’m very much interested are writing and talking mostly with respect to technology domain itself.
Keeping the technical part aside, I’m a beginner Guitarist and I’m doing some self-learning in order learn to be able to play the Guitar. I am also a foodie and I love to try different cuisines and different restaurants. I have a wanderlust I like travelling and exploring different places and in addition to that, I like spending time in nature and trekking.