@massimo-cassandro/minimo 1.36.1 → 1.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev-tools/starter-kit/source_files/app/email/_mail-properties.scss +18 -0
- package/dev-tools/starter-kit/source_files/app/email/mail-embed.scss +68 -0
- package/dev-tools/starter-kit/source_files/app/email/mail-inline.scss +203 -0
- package/dev-tools/starter-kit/source_files/app/email/readme.md +26 -0
- package/dev-tools/starter-kit/source_files/app/email/{_mail-properties.css → versione postcss/_mail-properties.css } +2 -5
- package/dev-tools/starter-kit/source_files/app/email/{mail-embed.css → versione postcss/mail-embed.css } +14 -15
- package/dev-tools/starter-kit/source_files/app/email/{mail-inline.css → versione postcss/mail-inline.css } +50 -61
- package/dev-tools/starter-kit/source_files/app/email/{postcss.config.mjs → versione postcss/postcss.config.mjs } +1 -1
- package/{snippets/twig-symfony → dev-tools/starter-kit/source_files/root/_sf/templates}/_main-tpl.html.twig +3 -0
- package/dev-tools/starter-kit/source_files/root/{sf_templates → _sf/templates}/email/_email-tpl.html.twig +8 -9
- package/dev-tools/starter-kit/source_files/root/_sf/templates/email/css/.gitkeep +0 -0
- package/dev-tools/starter-kit/source_files/root/_sf/templates/email/imgs/.gitkeep +0 -0
- package/dev-tools/starter-kit/source_files/root/jsconfig.json +1 -1
- package/dev-tools/starter-kit/source_files/root/package-tpl.json +5 -2
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/css-rules.mjs +1 -0
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/custom-props-purgecss-plugin.mjs +328 -0
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/get-jsConfig-aliases.mjs +1 -0
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/inline-critical-css.mjs +1 -0
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/mini-svg-data-uri-loader.cjs +1 -0
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/postcss.config.mjs +9 -5
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/purgecss-setup.mjs +23 -27
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/svg-rules.mjs +1 -0
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/svgo.config.mjs +1 -0
- package/dev-tools/starter-kit/source_files/root/webpack.config.mjs +137 -65
- package/dev-tools/starter-kit/starter-install.sh +2 -1
- package/dev-tools/starter-kit/webpack-config-upg.md +147 -0
- package/package.json +1 -1
- package/src/css/forms/form-group.css +0 -1
- package/src/minimo.css +42 -42
- package/dev-tools/starter-kit/source_files/root/sf_templates/email/css/mail-embed.css +0 -1
- package/dev-tools/starter-kit/source_files/root/sf_templates/email/css/mail-inline.css +0 -1
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/purgecss-variables-safelist.mjs +0 -92
- /package/{snippets/twig-symfony → dev-tools/starter-kit/source_files/root}/_env.local +0 -0
- /package/{snippets/twig-symfony → dev-tools/starter-kit/source_files/root/_sf}/symfony-webpack-setup.md +0 -0
- /package/{snippets/twig-symfony → dev-tools/starter-kit/source_files/root/_sf/templates}/bundles/TwigBundle/Exception/error.html.twig +0 -0
- /package/{snippets/twig-symfony → dev-tools/starter-kit/source_files/root/_sf/templates/incl}/flash-messages.html.twig +0 -0
- /package/{snippets/twig-symfony → dev-tools/starter-kit/source_files/root/_sf/templates/incl}/minimo-form-layout.html.twig +0 -0
- /package/snippets/{twig-symfony → symfony}/ImgViewerController.php +0 -0
- /package/snippets/{twig-symfony → symfony}/UnsplashController.php +0 -0
- /package/snippets/{twig-symfony → symfony}/ViewerController.php +0 -0
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// webpack-modules/purgecss-variables-safelist.mjs
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import { globSync } from 'glob';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
Genera l'elenco di custom properties da passare a `safelist.variables` di PurgeCSS.
|
|
7
|
-
L'elenco viene ricalcolato in memoria a ogni avvio di webpack: nessun file su disco.
|
|
8
|
-
|
|
9
|
-
Perché serve: PurgeCSS (`variables: true`) registra l'uso delle variabili solo
|
|
10
|
-
nelle regole che effettivamente elabora, all'interno del singolo asset css.
|
|
11
|
-
Restano quindi "invisibili" gli usi di var() che avvengono:
|
|
12
|
-
|
|
13
|
-
1. nei blocchi racchiusi tra i commenti `purgecss start/end ignore`
|
|
14
|
-
(presenti ad es. nei sorgenti di minimo): le regole vengono mantenute,
|
|
15
|
-
ma le custom properties che consumano verrebbero rimosse dal :root;
|
|
16
|
-
2. nei css caricati fuori dagli asset purgati (shadow DOM dei web components,
|
|
17
|
-
import con `?raw`): consumano le props del :root della pagina;
|
|
18
|
-
3. nelle dichiarazioni di un asset consumate in un altro asset
|
|
19
|
-
(es. override di tema definiti nel css di una pagina e consumati
|
|
20
|
-
dal css globale): vanno indicate tramite `seeds`.
|
|
21
|
-
|
|
22
|
-
Inoltre `safelist.variables` NON segue le catene di dipendenze (una prop
|
|
23
|
-
safelisted resta nel css, ma i suoi riferimenti var() non vengono marcati
|
|
24
|
-
come usati: `--a: var(--b)` in safelist non salva `--b`): l'elenco viene
|
|
25
|
-
quindi espanso con la chiusura transitiva calcolata sul grafo di tutte le
|
|
26
|
-
dichiarazioni `--x: ...` presenti nei sorgenti.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
const VAR_REFS_REGEX = /var\(\s*(--[A-Za-z0-9_-]+)/g;
|
|
30
|
-
const DECLARATION_REGEX = /(--[A-Za-z0-9_-]+)\s*:\s*([^;}]+)/g;
|
|
31
|
-
const IGNORE_START_REGEX = /\/\*\s*purgecss start ignore\s*\*\//;
|
|
32
|
-
const IGNORE_END_REGEX = /\/\*\s*purgecss end ignore\s*\*\//;
|
|
33
|
-
|
|
34
|
-
const varRefs = (cssText) => [...cssText.matchAll(VAR_REFS_REGEX)].map(m => m[1]);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @param {object} params
|
|
38
|
-
* @param {string[]} params.declarationGlobs glob dei css che contribuiscono al grafo
|
|
39
|
-
* delle dipendenze; i loro blocchi `purgecss ignore` contano come usi
|
|
40
|
-
* @param {string[]} [params.shadowGlobs] glob dei css usati fuori dagli asset purgati
|
|
41
|
-
* (shadow DOM / `?raw`): TUTTI i loro usi di var() contano
|
|
42
|
-
* @param {(string|RegExp)[]} [params.seeds] props da mantenere comunque (nomi o pattern
|
|
43
|
-
* risolti sui nomi dichiarati), es. override consumati in un altro asset
|
|
44
|
-
* @returns {string[]} elenco ordinato di nomi di custom properties
|
|
45
|
-
*/
|
|
46
|
-
export function purgecssVariablesSafelist({ declarationGlobs, shadowGlobs = [], seeds = [] }) {
|
|
47
|
-
|
|
48
|
-
const declaredRefs = new Map(); // nome → Set(var() referenziate nelle sue dichiarazioni)
|
|
49
|
-
const usages = new Set(); // usi da mantenere (blocchi ignore + shadow css)
|
|
50
|
-
|
|
51
|
-
for (const file of globSync(declarationGlobs, { nodir: true })) {
|
|
52
|
-
const src = fs.readFileSync(file, 'utf8');
|
|
53
|
-
|
|
54
|
-
// grafo delle dipendenze: ogni dichiarazione `--x: ...` con le var() nel valore
|
|
55
|
-
for (const declaration of src.matchAll(DECLARATION_REGEX)) {
|
|
56
|
-
const [, name, value] = declaration;
|
|
57
|
-
if (!declaredRefs.has(name)) {
|
|
58
|
-
declaredRefs.set(name, new Set());
|
|
59
|
-
}
|
|
60
|
-
varRefs(value).forEach(ref => declaredRefs.get(name).add(ref));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// usi di var() nei blocchi `purgecss start/end ignore`
|
|
64
|
-
src.split(IGNORE_START_REGEX).slice(1).forEach(chunk => {
|
|
65
|
-
varRefs(chunk.split(IGNORE_END_REGEX)[0]).forEach(ref => usages.add(ref));
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// shadow css: ogni uso di var() conta
|
|
70
|
-
for (const file of globSync(shadowGlobs, { nodir: true })) {
|
|
71
|
-
varRefs(fs.readFileSync(file, 'utf8')).forEach(ref => usages.add(ref));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// risoluzione dei seeds sui nomi dichiarati
|
|
75
|
-
const declaredNames = [...declaredRefs.keys()];
|
|
76
|
-
const seedNames = seeds.flatMap(seed =>
|
|
77
|
-
typeof seed === 'string' ? [seed] : declaredNames.filter(name => seed.test(name))
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
// chiusura transitiva delle dipendenze
|
|
81
|
-
const result = new Set();
|
|
82
|
-
const queue = [...seedNames, ...usages];
|
|
83
|
-
while (queue.length > 0) {
|
|
84
|
-
const name = queue.pop();
|
|
85
|
-
if (!result.has(name)) {
|
|
86
|
-
result.add(name);
|
|
87
|
-
queue.push(...(declaredRefs.get(name) ?? []));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return [...result].sort();
|
|
92
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|