Path in the Gestor bibliotecas/assets-externos.php
Every third-party JavaScript and CSS file the Gestor uses goes through a single registry, with a pinned version. A module does not write the tag: it calls assets_externos_incluir('codemirror').
The file is served from gestor/assets/vendor/<library>/<version>/ when it exists, and from the registry's CDN when it does not. That way the visitor's IP does not go to third-party CDNs, and a new npm release does not reach production without review.
Registered libraries
| Name | Version | Files |
|---|---|---|
jquery |
3.7.1 | jquery.min.js |
fomantic-ui |
2.9.4 | semantic.min.css/.js + theme fonts and icons |
fomantic-icon |
2.9.4 | Icons only, for Tailwind layouts |
codemirror |
5.65.20 | Core, theme, addons and HTML/CSS/JS/Markdown modes |
quill |
2.0.3 | quill.snow.css, quill.min.js |
sortablejs |
1.15.6 | Sortable.min.js |
lucide |
0.544.0 | lucide.min.js |
qrcodejs |
1.0.0 | qrcode.min.js |
fingerprintjs |
4 | fp.min.js |
tailwindcss-browser |
4.3.0 | Tailwind compiler used in the visual editor; follows the offline build version |
New installations already ship the files in gestor/assets/vendor/. To download what is missing (or a new version after changing the registry):
c2f assets:vendor [--lib=codemirror] [--listar] [--forcar]A library's arquivos entry lists what is downloaded but does not become a tag (the fonts the CSS requests by relative path). Without them, served from disk, Fomantic loses its icons.
Usage
gestor_incluir_biblioteca('assets-externos');
assets_externos_incluir('sortablejs'); // false if the name is not registered
$tags = assets_externos_tags('quill', $vendorPath, $vendorUrl); // ['css' => [...], 'js' => [...]]
$map = assets_externos_urls_js(['codemirror']); // library => file => URL, for JavaScriptassets_externos_urls_js() exists for code that builds tags in the browser (the preview iframes and the edit bar): it gets the same URLs, without knowing versions or hosts.
Pitfalls
-
The fallback to the CDN is silent: a file missing from
vendor/is served from the CDN without warning. After changing a version, runc2f assets:vendor. -
assets_externos_incluir()adds the CSS tags throughgestor_pagina_css_incluir($tag), which pushes them onto the end-of-page JavaScript queue (gestor.php). The CSS works, but loads after the content. -
The local URL uses
url-raiz, which includes the language prefix when it is in the URL.
Internal helpers (used by the functions above; rarely called directly): assets_externos_registro(), assets_externos_url(), assets_externos_urls_map().
Functions
Generated from gestor/bibliotecas/assets-externos.php · 6 functions
assets_externos_registro
view source · line 47 ↗assets_externos_registro(): array<string, array{versao: string, cdn: string, css: list<string>, js: list<string>}>Registro central: nome => versão + arquivos.
Returns
assets_externos_url
view source · line 217 ↗assets_externos_url(array $lib, string $nome, string $arquivo, string $vendorFisico, string $vendorPublico): stringURL de um arquivo da biblioteca: local quando existe, CDN como fallback.
Parameters
$libarray- Entrada do registro.
$nomestring- Identificador da biblioteca (subdiretório em
vendor/). $arquivostring- Nome do arquivo dentro da biblioteca.
$vendorFisicostring- Caminho físico de
assets/vendor/(com separador final). $vendorPublicostring- URL pública de
vendor/(com barra final).
Returns
assets_externos_tags
view source · line 238 ↗assets_externos_tags(string $nome, string $vendorFisico = '', string $vendorPublico = ''): array{css: list<string>, js: list<string>}Tags de uma biblioteca registrada.
Parameters
$nomestring- Identificador no registro.
$vendorFisicostring- Caminho físico de
assets/vendor/. $vendorPublicostring- URL pública de
vendor/.
Returns
assets_externos_urls_map
view source · line 279 ↗assets_externos_urls_map(list<string> $nomes = Array(), string $vendorFisico = '', string $vendorPublico = ''): array<string, array<string, string>>Mapa biblioteca => arquivo => URL das bibliotecas pedidas (req-156).
Parameters
$nomeslist<string>- Identificadores no registro; vazio devolve todas as bibliotecas.
$vendorFisicostring- Caminho físico de
assets/vendor/. $vendorPublicostring- URL pública de
vendor/.
Returns
assets_externos_urls_js
view source · line 308 ↗assets_externos_urls_js(list<string> $nomes = Array()): array<string, array<string, string>>assets_externos_urls_map() resolvido com os caminhos do ambiente corrente (req-156).
Parameters
$nomeslist<string>- Identificadores no registro.
Returns
assets_externos_incluir
view source · line 329 ↗assets_externos_incluir(string $nome): boolInclui uma biblioteca de terceiro no pipeline da página.
Parameters
$nomestring- Identificador no registro (ex.:
sortablejs).
Returns