eibiflo / cf_cookiemanager

Simple Typo3 Cookie Manager
GNU General Public License v2.0
11 stars 6 forks source link

Removing default CSS/JS #51

Open srchild opened 2 days ago

srchild commented 2 days ago

config.removeDefaultCss doesn't stop the loading of the css file because it isn't configured as _CSS_DEFAULT_STYLE

Setting page.includeCSS.cookieconsent = or page.includeCSS.cookieconsent > in my sitepackage also doesn't stop it.

I want to stop it loading of your file so that I can copy the css into my main css file and reduce the number of elements in a page load.

Is there a way to do it?

Perhaps your extension typoscript could be adjusted to designate it as _CSS_DEFAULT_STYLE so that it can be removed by config.removeDefaultCss

And, same question about the js - can I stop the loading of that so that I can include it in another file which is already being loaded?

Thanks

eibiflo commented 2 days ago

Hello @srchild,

Thank you for the info! It seems like it’s incorrectly registered as a plugin. I’m using the site package approach and will look into implementing it correctly in the next release.

For now, page.includeCSS.cookieconsent >

should work. Could it be that your TypoScript order is incorrect? Themes Doc

Regarding the JavaScript, does #20 address your issue, or do you want to include the JS code in a Build System?

The JavaScript can be included via an external file or inline in the HTML DOM, but it’s generated dynamically. Therefore, it cannot be included directly in your own JavaScript code. (See: CookieFrontendController.php, Line 112) This is not the best solution, we are currently discussing it in the Slack channel to ensure that the templates also receive Fluid support. This is already an known Issue.

srchild commented 2 days ago

Thanks for the quick response.

page.includeCSS.cookieconsent > does now work for me, after I reordered my included TS to place cf_cookiemanager above my site package, so thanks for that tip.

20 looks interesting, I hadn't thought of that but might implement it. Currently I'm focusing more on improving page load speed, for example loading only one css file instead of lots of small files (and same interest for js, but clearly that won't work for dynamically generated js)

Thanks

eibiflo commented 2 days ago

No Problem, fine.

I'll take a closer look at _CSS_DEFAULT_STYLE, as that would make more sense than the current code, i think.

If you're already working on optimizing the page load speed, I'm open to suggestions. You probably want to minify everything into one file, or do you have another plan?

For example, you could minify this section, but keep in mind that the configuration is dynamically delivered as JSON and processed by the controller.

Is there anything else I could optimize, regardless of usage, to ensure all users of the extension benefit right away?