Comments (2)
suggestions
-
Use Rollup for tree-shaking and bundling in JavaScript, then use ESM’s
await import
syntax intheme.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.
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)
- [BUG] 404 page does not respect the current language HOT 4
- Don‘t escape URLs in JSON-LD on the homepage
- [BUG] Cloudflare 的 Web Analytics 的功能的js加载出错 HOT 1
- [BUG?] should the `caption` attribute from the `figure` shortcode generate the caption with `image-caption` class? HOT 1
- [BUG] 本地预览shortcodes有效,但是vercel部署过后shortcodes无法找到 HOT 2
- [BUG] 搜索页面的a标签宽度为0,无法点击到 HOT 2
- [BUG] Some problem... HOT 2
- [FEATURE] submenus HOT 1
- [BUG] Error with markup in example sites and github actions to pages HOT 2
- [BUG] site.webmanifest not applied HOT 4
- [BUG] Image deformity in chrome v121 HOT 5
- [FEATURE] Use prettier to format go template html HOT 1
- [FEATURE] Don't cache remote image link when cacheRemoteImages is enabled HOT 2
- [FEATURE] Site.Author is deprecated in hugo v0.120 HOT 2
- [BUG] shortcode render failed
- [BUG] Disable Black Mode HOT 3
- [BUG] Suggest to remove polyfill.io HOT 1
- [FEATURE] 如何让首页像存档页面那样布局显示? HOT 1
- [FEATURE]将行内代码和代码块的样式设置分离,Separate the Style Settings for Inline Code and Code Blocks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doit.