@emulsify/core 4.3.1 → 4.3.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.
|
@@ -17,10 +17,6 @@ import {
|
|
|
17
17
|
isComponentMetadataFile,
|
|
18
18
|
} from './source-file-index.js';
|
|
19
19
|
|
|
20
|
-
/** Determine whether a Twig file is a partial (filename starts with `_`). */
|
|
21
|
-
const isPartial = (filePath) =>
|
|
22
|
-
(filePath.split('/')?.pop() || '').trim().startsWith('_');
|
|
23
|
-
|
|
24
20
|
/**
|
|
25
21
|
* Copy Twig templates and component metadata to `dist/`.
|
|
26
22
|
*
|
|
@@ -51,11 +47,18 @@ export function copyTwigFilesPlugin({
|
|
|
51
47
|
|
|
52
48
|
plan = [];
|
|
53
49
|
|
|
50
|
+
// A leading underscore excludes a stylesheet from compilation, because a Sass
|
|
51
|
+
// partial is inlined into whatever imports it and has no output of its own.
|
|
52
|
+
// Twig has no equivalent: `{% include %}` and `{% embed %}` resolve at render
|
|
53
|
+
// time against the emitted tree, so an underscored template is a file the site
|
|
54
|
+
// still has to find. Skipping those left the include unresolvable at runtime.
|
|
54
55
|
for (const file of sourceFileIndex.componentFiles()) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
if (
|
|
57
|
+
!file.absPath.endsWith('.twig') &&
|
|
58
|
+
!isComponentMetadataFile(file.absPath)
|
|
59
|
+
) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
59
62
|
|
|
60
63
|
plan.push({
|
|
61
64
|
absPath: file.absPath,
|
|
@@ -65,7 +68,6 @@ export function copyTwigFilesPlugin({
|
|
|
65
68
|
|
|
66
69
|
for (const file of sourceFileIndex.globalFiles()) {
|
|
67
70
|
if (!file.absPath.endsWith('.twig')) continue;
|
|
68
|
-
if (isPartial(file.relPath)) continue;
|
|
69
71
|
|
|
70
72
|
plan.push({
|
|
71
73
|
absPath: file.absPath,
|