Giter Site home page Giter Site logo

Comments (2)

Sped0n avatar Sped0n commented on June 8, 2024

suggestions

  • Use Rollup for tree-shaking and bundling in JavaScript, then use ESM’s await import syntax in theme.js to dynamically import the required libraries.

  • For CSS, I think there are two approaches. One is to replace it entirely with Tailwind to reduce coupling. The other is to divide it into some small files like the critical CSS way. I might prefer the former one because the latter can be time-consuming and labor-intensive for a large static generated site. Additionally, I think [what Stylex has adopted](https://stylexjs.com/docs/learn/thinking-in-stylex/#one-small-file-over-many-smaller-files) is inspiring.

but

Benchmarking is benchmarking, and the improvements from these optimizations are limited in most user scenarios nowadays. Personally, I don’t find Doit’s loading speed unacceptable. The purpose of using Hugo as a framework is simplicity and developers have to consider most things themselves. It would be difficult to achieve best practices in so many aspects, or it will come with great complexity, which hugo is not born for.

from doit.

HEIGE-PCloud avatar HEIGE-PCloud commented on June 8, 2024

I would say the performance of DoIt is fine currently based on real world statistics from Google PageSpeed Insights (Collected from all Chrome users) and Cloudflare Pages Analytics (The hosting service provider).

The main reason why multiple attempts have been closed as you pointed out is because I have limited personal bandwith on maintaining this project, and all these changes are rather complicated. Also, a lot of low hanging fruits you might think of have already been implemented. To make things worse, we have zero testing for DoIt so it takes a lot of care to make sure nothing is broken and backwards compatibility is properly kept.

You will find most external JavaScript and CSS libraries are only loaded if required based on individual page configurations (See KaTeX as an example). And of course all JavaScript and CSS bundles are minified as you suggested here.

Here are some further optimisation ideas if you want to look into it:

  • Load LightGallery only when the user clicks the image (Already implemented for search)
  • Get rid of clipboard.js (I think now all browsers have a consistent API for this)
  • Inline FontAwesome icons (Quite tricky because of this https://hugodoit.pages.dev/theme-documentation-content/#fontawesome)
  • Get rid of animate.css and cherry pick the necessary animations
  • Refactor all SCSS styles into tailwindCSS. (Quite tricky because of the sheer volume of the styles and dependencies in some JavaScript code)
  • Upgrade deprecated dependencies (e.g. autocomplete for search, LightGallery for photos etc)
  • Refactor code blocks to use the markdown render hook and reduce JavaScript dependency.

from doit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.