2020/1/7 0:22:35
|
---|
|
Where does the core inject all this javascript?I'm trying to find out where the core automatically injects javascript in my page. I use Bootstrap theme, and I came to the conclusion that I have 2 jquery scripts, and a load of other scripts as well that are included automatically on my page. Google proposes to change the place on the page, in order to speed the rendering, so I would like to know where the core does that, and perhaps alter the behaviour. |
_________________
|
2020/1/7 9:19:04
|
---|
|
Re: Where does the core inject all this javascript?These comes from <{$icms_module_header}> variable in theme. Sadly, right now I think there is no way to specify place where to output this variable. |
2020/1/7 9:51:28
|
---|
|
Re: Where does the core inject all this javascript?This is the question I had in the slack channel - "async deferred" can be used to move when the javascript is loaded. The actual place is during the renderMetas method of icms_view_theme_Object. This works for most things and I have it running this way on several sites. The Billboard module does not work properly on the initial page load and renders separate images for each slide until you refresh (works sometimes) |
2020/1/7 23:42:32
|
---|
|
Re: Where does the core inject all this javascript?The billboard module needs major updates and it is no longer used on the site at the moment. I'll look into the icms_view_theme_Object, because I want to understand where the different javascript and CSS files get included in the core. I believe some of them are not needed on every page. |
_________________
|
2020/1/8 18:49:25
|
---|
|
Re: Where does the core inject all this javascript?icms_core_theme_Object does all the work, but the work to be done is defined in /header.php. Just search for ->addScript and ->addStylesheet include/cp_functions:: icms_cp_header() creates the work for the admin area.
|
2020/1/29 8:10:10
|
---|
|
Re: Where does the core inject all this javascript?I found the locations in the header file where all the different files were loaded, and I included a switch statement so that I can switch the way includes are done by simply defining a boolean in the theme. When the boolean is true, I include a file 'combined.js' and 'combined.css', which are combined and minified versions of the different javascript and CSS files that are included at the moment. Whent he boolean is false, the old behaviour is still there. This reduces considerably the loading time (first time at least) of a page. I still have some small issues with the minifying, but I think I have identified the problem. |
_________________
|
2020/1/29 19:08:02
|
---|
|
Re: Where does the core inject all this javascript?There are minify and combine functions in the core - and currently left unused. Mostly because the resulting file was placed in the cache/ folder and at least one of the js and css files had some specific paths that didn't work when the file was in a different location. |
2020/2/10 14:52:31
|
---|
|
Re: Where does the core inject all this javascript?Those issues are the same ones that I encountered during my tests. After that, I was investigating webpack, and there you can include files with a specific directive, and it tells webpack to make it a relative path. Perhaps this kind of functionality should be left to the front-end developers and not taken on by the CMS? |
_________________
|
2020/2/10 14:53:08
|
---|
|
Re: Where does the core inject all this javascript?As a side note, this thread does not show paragraph tags when I post something new. Strange |
_________________
|
2020/2/16 14:01:34
|
---|
|
Re: Where does the core inject all this javascript?From a new post in an old topic - https://www.impresscms.org/modules/iforum/viewtopic.php?post_id=50656#forumpost50656 Wondering about the options below |