Closed (fixed)
Project:
TacJS
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Jul 2020 at 14:30 UTC
Updated:
26 Oct 2023 at 10:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
prudloff commentedThe attached patch makes Drupal load the following files:
In order to only load the language file we need, it forces tarteaucitron's language to the current Drupal langague. (This has the added benefit of making sure the website and tarteaucitron always use the same language.)
The main remaining issue is that will only work correctly if
useExternalJsanduseExternalCssare enabled.Should we force-enable them for everyone?
But then what about other legitimate use cases of
useExternalCss(like people who want to use their own custom CSS)?Comment #3
boulaffasae commentedHi prudloff,
Yes tarteaucitron currently use asynchronous loading, which is more optimized than serving an aggregated file. If one day the library added support for loading files with
<script />&<link />we could update our code source accordingly.Comment #4
prudloff commentedWell, technically tarteaucitron already supports that. That's what the
useExternalJsoption is for, so you can loadtarteaucitron.services.jsany other way you want.I understand why tarteaucitron (as a general library not tied to a specific CMS) loads script like that by default, but I also think Drupal modules should load every resource with the Drupal libraries system (so that other modules can apply various optimizations to these resources).
Comment #5
boulaffasae commentedI made some changes in your patch if it's okey :). Please review my patch & let's test this together before applying patch to the 3.11 version :)
drupalSettings.path.currentLanguageglobally, we can use this instead of'lang' => $lang.componentbytheme, Wanna do a Call of Duty 1 vs 1 to decide ?We need just to enable useExternalCss/useExternalJs by default so that Drupal optimize & load required css & js. For people who want to use their own custom CSS, Drupal have a great solution to overridde assets.
- Libraries can now be overridden and extended by themes
Comment #6
boulaffasae commentedComment #7
prudloff commentedThe language file has to be loaded after the library (because it accesses the tarteaucitron object).
Apart from that, everything seems to work correctly.
Comment #9
boulaffasae commented