[Refactor] migrate all assets to webpacker (JS CSS and images)
-
https://github.com/thoughtbot/administrate/wiki/Rails-6-&-Webpacker > Follow this -
move stylesheets -
move images -
compare new bundle size to old one (cf below)
change list:
- all CSS, JS and images moved from
app/assets
toapp/webpacker
-
stylesheet_link_tag
becomesstylesheet_pack_tag
-
image_tag
becomesimage_pack_tag
- for SCSS packs to be created, they NEED to have a JS pack associated to it.
- FontAwesome upgraded from 4 to 5:
- some icons changed names
- old icons with
-o
suffix like.fa.envelope-o
become.far.envelope
-
print
stylesheet was included independently in theapp/views/common/_meta
partial, I've moved it to be imported and bundled together with the mainapplication
stylesheet. it's tiny - explode
require 'rails/all'
into separate requires in order to exclude sprockets (even though it still seems to be loading
upon releasing :
-
extensive test of the app on demo: -
fonts -
all layouts: -
administrate -
landing -
application -
application_users -
mail
-
-
images, images inserted through CSS, favicon etc -
FA icons -
js interactions -
timepickers
-
-
recheck lighthouse score (current on demo: 73)
-
comparison of bundle sizes before and after seems constant (but way too high) for application and landing packs (done using SECRET_KEY_BASE=test RAILS_ENV=production rails assets:precompile
on both master and this branch):