-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
replace leaflet files from assets.rb in questionRich.html and _mapDependencies.html #7945
replace leaflet files from assets.rb in questionRich.html and _mapDependencies.html #7945
Conversation
Codecov Report
@@ Coverage Diff @@
## main #7945 +/- ##
==========================================
- Coverage 82.17% 81.28% -0.89%
==========================================
Files 100 101 +1
Lines 5772 5872 +100
==========================================
+ Hits 4743 4773 +30
- Misses 1029 1099 +70
|
@jywarren @cesswairimu Should we add the remaining files of /lib mentioned in this file for precompilation by augmenting the assets.rb array? Thanks ✌️ |
Hey @jywarren @cesswairimu @emilyashley Looking forward to your input on this 😄 |
edff18e
to
63014c5
Compare
@VladimirMikulic can you help me with the travis tests failure? Thanks ✌️ |
Hi @Tlazypanda. The error in Travis tells us that the route |
Hmm..weird I removed those assets which would otherwise be available from the asset pipeline @VladimirMikulic |
I believe layer.png often causes issues in the asset pipeline, actually! Maybe this helps? #2537 But i recall this kind of thing with Leaflet image assets, esp. those referred to in CSS, because CSS doesn't respect asset pipeline routing (i think that's right!). So it could be worth a broader search for Good luck, this looks great and thanks to both of you! |
@jywarren Found the issue! So basically whenever we are trying to move this into the asset pipeline it is searching in the route |
Hey @cesswairimu @jywarren any update on what should be my course of action 😅 Thanks ✌️ |
OK this could be linked to #5095 (comment) -- is that right? For the broader question, originally we included assets in the editor because we thought it optimal to only include them here, instead of on any page (the editor has an especially large number of assets, not needed elsewhere on the site). But I totally trust your judgement and analysis of whether re-organizing which assets are loaded where and how they're minified, so as long as nothing breaks 😅 please go for it! Thank you!!! |
63014c5
to
23d903a
Compare
Hey @jywarren @cesswairimu I am also fairly confused as to what can be done here 😅 The reason being if I am supposed to reference the images without adding them to assets/images route then I will have to add the path of the specific images dir to the https://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets |
b61f8dd
to
dddfda3
Compare
3568a35
to
ad8881f
Compare
@cesswairimu @jywarren can you kindly review? Thanks ✌️ |
@Tlazypanda quick question...are the contents of the files in /assets identical to the ones in /lib? |
Hey @cesswairimu I am not sure I completely follow 😅 on precompilation all are put together in assets directory but since here we are referencing image from css we need to add relative path so since this is an external lib and we can't make changes to the code (since it is yarn package) so I removed the file that required the css leaflet.css (as you can see in _mapDependencies now it is referenced from /lib suggesting that is not part of asset pipeline) The scripts removed are already present in the application.js |
aha! gotcha thanks 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am approving it but maybe you might want to do this change in follow up PR or here only. No worries, thanks 😄
@@ -5,21 +5,15 @@ | |||
<link href="/lib/publiclab-editor/dist/PublicLab.Editor.css" rel="stylesheet"> | |||
|
|||
<!-- required for MapModule --> | |||
<link href="/lib/leaflet/dist/leaflet.css" rel="stylesheet"> | |||
<script src="/lib/leaflet/dist/leaflet.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep this and remove from application
level, because as you are also working on performance improvement, having a light entry page should take less time, right?
When these libraries are required they should be loaded only then (lazy loading), what do you think?
😄 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Tlazypanda any comment on these last questions from @sagarpreet-chadha ? My apologies for replying late to these. Thank you!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jywarren @sagarpreet-chadha I totally missed this 😅 my apologies ...ummm can we do this in a follow up pr because I think the leaflet.js and css files are actually required on many routes since the map is loaded on dashboard/user profile/all editor pages/map routes etc so might have to investigate it more to make sure that removing it won't break anything. What do you think? Thanks ✌️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's totally fine. Always game to split up PRs! Does that make this PR otherwise good to merge? Thank you!
Retriggering once more! |
Great work, @Tlazypanda !!! |
Fixes #7922
Replace leaflet files which are already present in asset pipeline by using javascript_include_tag and stylesheet_link_tag. Also removed files which are already served from application.js and application.css. Added some files to assets.rb for precompilation as well.
Edited _mapDependencies as well since some files there also needed to be replaced and in testing inorder to reduce js execution time.
rake test
@publiclab/reviewers
for help, in a comment belowScreenshots
Before
After
Thanks!