How to use ESBuild to load font files for Bootstrap Icons

preview_player
Показать описание
A look at the copy and file loaders for ESBuild to load a font file to get Bootstrap Icons to work with Rails 7. The solution is surprisingly simple!

0:00 Bootstrap Icons font file dilemma
2:09 ESBuild setup with my Rails 7
3:39 Look at CSS in the ESBuild output
4:44 ESBuild file vs copy loader
6:28 ESBuild copy loader (attempt 1 ❌)
9:20 Modify Rails asset pipeline include path (attempt 2 ❌)
12:02 ESBuild precompile to rewrite the font file URL (attempt 3 ❌)
14:32 Change the font URL in Bootstrap's SCSS defaults 🎉

Resources:

Outtro Music:
CO.AG - Escape the Apex
Рекомендации по теме
Комментарии
Автор

I discovered that I missed a step for Rails production. See:

# Rakefile
task "assets:precompile" =>

#
require 'fileutils'

desc 'Copy node_modules related assets'
task do
source =
dest = 'public/assets/'

puts 'Copying Bootstrap Icons files'
FileUtils.copy_entry(source, dest)
end

WinstonCodesOn