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

Asset improvements #1990

Merged
merged 4 commits into from
Dec 31, 2024
Merged

Asset improvements #1990

merged 4 commits into from
Dec 31, 2024

Conversation

liamcmitchell
Copy link
Contributor

I originally wanted to look into page load issues/improvements but got distracted on the way. I plan to keep going but thought you might want to review/merge these changes incrementally.

  • Import handlebars templates via plugin (missed in Move to esbuild and update npm packages #1605)
  • Remove tmp/handlebars dir, handlebars globals, handlebars script tags
  • Refactor assets build script to run builds in parallel
  • Remove duplicate error & warn logs
  • Clean outdir on start only to avoid broken state on rebuilds
  • Disable minification in watch mode
  • Remove unneeded npx prefixes in package scripts

Before

$ time mix build

> build
> node build/build.js


  ../formatters/epub/dist/epub-elixir-B7F5ZCEW.css  14.3kb
  ../formatters/epub/dist/epub-erlang-KHQWEOVK.css  14.3kb
  ../formatters/epub/dist/epub-LSJCIYTM.js           499b 

⚡ Done in 53ms

  ../formatters/html/dist/html-CBA5W32Y.js                             101.0kb
  ../formatters/html/dist/html-elixir-QYVRUQZX.css                      65.4kb
  ../formatters/html/dist/html-erlang-WM4KXD7K.css                      65.3kb
...
  ../formatters/html/dist/handlebars.templates-K7URE6B4.js              32.8kb
...
  ...and 2 more output files...

⚡ Done in 150ms

  ../formatters/html/dist/handlebars.runtime-NWIB6V2M.js  19.9kb

⚡ Done in 27ms
Compiling 26 files (.ex)
Generated ex_doc app
Generating docs...
View "html" docs at "doc/index.html"
View "epub" docs at "doc/ExDoc.epub"
mix build  11.81s user 1.59s system 79% cpu 16.768 total

After

$ time mix build

> build
> node build/build.js


  ../formatters/epub/dist/epub-elixir-PZYIPPXT.css  14.3kb
  ../formatters/epub/dist/epub-erlang-NL227KN3.css  14.3kb
  ../formatters/epub/dist/epub-LSJCIYTM.js           499b 

⚡ Done in 58ms

  ../formatters/html/dist/html-DLHCPQRW.js                             149.9kb
  ../formatters/html/dist/html-elixir-RHSUA5ZT.css                      65.5kb
  ../formatters/html/dist/html-erlang-OE5MLTOC.css                      65.5kb
...
  ...and 1 more output file...

⚡ Done in 360ms
Compiling 26 files (.ex)
Generated ex_doc app
Generating docs...
View "html" docs at "doc/index.html"
View "epub" docs at "doc/ExDoc.epub"
mix build  11.74s user 1.52s system 98% cpu 13.463 total

Total JS is a little smaller and build is a little faster.

Tests

$ npm run test

> test
> karma start ./karma.conf.js --single-run

31 12 2024 09:08:10.115:INFO [esbuild]: Compiling to /private/var/folders/b2/h4z9yhkd5pv7g626sbq__hh40000gn/T/2b053bfab7e6f70242dd30f6dcdf346f-bundle.js...
31 12 2024 09:08:10.530:INFO [esbuild]: Compiling done (414ms)
31 12 2024 09:08:10.532:INFO [karma-server]: Karma v6.4.1 server started at http://localhost:9876/
31 12 2024 09:08:10.533:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
31 12 2024 09:08:10.540:INFO [launcher]: Starting browser Chrome
31 12 2024 09:08:19.507:INFO [Chrome 131.0.0.0 (Mac OS 10.15.7)]: Connected on socket Mg_sTo_t5WWF8NqwAAAB with id 39082165
Chrome 131.0.0.0 (Mac OS 10.15.7): Executed 19 of 19 SUCCESS (0.105 secs / 0.033 secs)
TOTAL: 19 SUCCESS

@josevalim josevalim merged commit 8c763fa into elixir-lang:main Dec 31, 2024
5 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@josevalim
Copy link
Member

The incremental changes are definitely better, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants