This course is archived!
This tutorial is built using Drupal 8.0. The fundamental concepts of Drupal 8 - like services & routing - are still valid, but newer versions of Drupal *do* have major differences.
06.
The webprofiler
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
6 Comments
How to install javascript libraries?
Hey Akshit,
You can do this in a few ways, but the JS dependency will eventually be stored in the package.json file. We do it via Yarn in our tutorials, e.g. if you want to add a jQuery as a JS dependency to your project - you can execute "yarn add jquery" - then the package.json will be created - similar to composer.json that we have in PHP, and there you will find your dependency. Also, Yarn will create yarn.lock file that has the same purpose as composer.lock in PHP. So, basically, Yarn is a package manager in JS world as Composer is package manager in PHP world.
I hope this helps! If you need more info about it - I'd recommend you to watch our JS tutorials first: https://symfonycasts.com/tr... , because install a JS dependency this way isn't enough to be able to start using it, as it will not be available on frontend. You need a tool like Webpack Encore that will allow it for users. I'd strongly recommend you to watch the course about Webpack Encore first: https://symfonycasts.com/sc...
Without Webpack Encore, the only way would be to do like devs did before, just download a JS library file, put it into a public folder to which users will have access, and add a script tag that will include the lib in your HTML pages - but that's much less cool than doing it via Yarn and Webpack Encore.
I hope this helps!
Cheers!
Hi Ryan,
I'm currently experiencing an issue with Web Profiler.
I have a fresh D8 instance ( Version 8.5.4 ) with the latest version of Devel plus libraries (D3 and Highlights).
The problem is quite weird...
The Profiler bar is visible only on /admin/modules/ page and sometimes appear/disappear in other sections..
example: admin/structure, front page..
I checked browser console.. No errors :-/
Soooo weird.
Have you ever seen something like that?
Hey Fabrizio S.,
Hm, weird... Do you have HTTP cache on the pages where you do not see the web profiler? Btw, could you double check you have a valid HTML structure in the source code, i.e. you have opening/closing html and body tags? You may probably try to validate your HTML with this validator: https://validator.w3.org/ . And try to "tail -f" your logs when load the page, probably you'll find some errors in logs.
Cheers!
Hi victor
Thank you for your kind feedback.
I don't know actually if this problem is somehow correlated to the Zend Opcache extension.
I checked the list of module reported issues on https://www.drupal.org/proj... and, somehow, the "Stopwatch is incompatible with OPCache" made me ring a bell.
I made a test by disabling opcache extension on my environment, after that, going back to my drupal instance and reloading the pages... voilà, the toolbar is there!!
Still bit weird by my opinion. But it works!
Hey Fabrizio S. ,
Glad you got it working! Hm, probably a temporary issue, or you need to upgrade stopwatch / opcache to the latest version.
Thanks for sharing your solution with others!
Cheers!
"Houston: no signs of life"
Start the conversation!