Tasuku_Sai
“esbuild” will bundle, properly, javascript files only, for on its website it says that there may be problems with bundling css files.
Does bundling js files save that much traffic so that it’s worth it to use the tool?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hello,
I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex











First 9 of 9 Posts
50kudos
The main benefits right now are tree-shaking, minification, and single (or a few) bundled file caching (browser does that, so it tends to load once per version). Esbuild can build css as entry point without any other config options, I haven’t seen any problem with css building.
It’s worth it for now, browser capability around this is improving (e.g. import map). Honestly esbuild config is really simple compared to js-based bundler.
Tasuku_Sai
What’s tree-shaking?
The browser is capable of caching 1 file as well as 5 ones. What’s the difference?
You haven’t listed any beneftis of using the tool in the first place. “It’s easy to use therefore one should use it”. What for? How about downsides?
derek-zhou
It really depends how much js you have. If I only use Phoenix Liveview and a bit of js I wrote, I don’t bundle. If I need to use a js framework for a project, I bundle.
Don’t trust words, benchmark yourself.
thiagomajesk
I think you perhaps have misunderstood the explanation for lack of context. This community has kind of a history with javascript build tools. We used to use Brunch, then Webpack and now we are using Esbuild, which is really simple to configure and use compared to existing options in the market. The decision to replace Webpack with Esbuild has been documented on the forums (if you are interested). For further explanations that are not just subjective opinions, I think it would actually be productive if you tried configuring the other tools and making the decisions if it’s worth it on your own.
It depends on the project’s asset delivery strategy… You still can deliver a huge bundle that the browser will cache and only redownload once a month or deliver lots of small files that are cached and change frequently. It really depends, there’s no “right” answer here. I encourage you to read a little bit more on those strategies to make it more clear how those different tools might help you.
benwilson512
You can also use GitHub - CargoSense/dart_sass: Install and run Dart Sass using Elixir. · GitHub combined with
esbuildto get sass without webpack.Kurisu
Yes I just followed a tutorial on setting up
CargoSense dart_sassto enable bootstrap and fontawesome with a phoenix 1.6 project.The only downside of dropping webpack I have for now is that with CargoSense dart_sass, I have to manually copy fonts to “priv/static/…” when they are referenced in imported css/sass files. The issue is reported on the github here: Images and fonts are missing from node_modules css files that use url('...') · Issue #22 · CargoSense/dart_sass · GitHub.
I don’t want to make a big deal out of this, but just in case there would be simple workarounds, I would take it. ^^
carterbryden
One solution I’ve found that I like because I haven’t had to adjust it is to just chain specialized build tools together.
For instance:
The configs are all super short and easy to read, run in milliseconds, and adding new front end packages is still just npm install.
I wonder if you could chain dart_sass and esbuild in some simple way that would being the fonts in for you?
Kurisu
Thank you for sharing your solution. I like it too. ^^
Yes that would be great, but for now I don’t have sufficient knowledge with those tools and I will just keep manually copying the needed fonts for imported sass styles. Otherwise I found dart_sass config very easy and straightforward.
Daan.T
esbuild is the pi π of build tools, simple, fast, and essential for phoenix projects.