ultimate-jekyll-manager 0.0.266 → 0.0.268

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.
@@ -130,18 +130,24 @@ function sass(complete) {
130
130
  logger.log('PurgeCSS enabled - removing unused CSS');
131
131
  const purgeCssStartTime = performance.now();
132
132
 
133
+ // Exclusion patterns for PurgeCSS content scanning
134
+ // NOTE: ! negation patterns DON'T work in PurgeCSS's content array because
135
+ // PurgeCSS passes each pattern to fast-glob individually (not as a batch),
136
+ // so negation patterns just return 0 files. Use skippedContentGlobs instead.
137
+ const skippedContentGlobs = [
138
+ // Exclude ALL theme directories (we re-include the active theme below)
139
+ `${rootPathPackage}/dist/defaults/**/_includes/themes/**`,
140
+ `${rootPathPackage}/dist/defaults/**/_layouts/themes/**`,
141
+
142
+ // Exclude test pages that reference components not used in production
143
+ `${rootPathPackage}/dist/defaults/**/pages/test/**/*.{html,liquid,md}`,
144
+ ];
145
+
133
146
  // Define content patterns for PurgeCSS
134
147
  const contentPatterns = [
135
- // All Ultimate Jekyll defaults EXCEPT themes subdirectories
148
+ // All Ultimate Jekyll defaults (exclusions handled by skippedContentGlobs)
136
149
  `${rootPathPackage}/dist/defaults/**/*.{html,liquid,md}`,
137
150
 
138
- // Explicitly exclude ALL theme directories, then include only the active theme
139
- `!${rootPathPackage}/dist/defaults/**/_includes/themes/**`,
140
- `!${rootPathPackage}/dist/defaults/**/_layouts/themes/**`,
141
-
142
- // Exclude test pages that include components we don't normally use (would prevent PurgeCSS from working)
143
- `!${rootPathPackage}/dist/defaults/**/pages/test/**/*.{html,liquid,md}`,
144
-
145
151
  // Include ONLY the active theme's files from UJM
146
152
  `${rootPathPackage}/dist/defaults/**/_includes/themes/${config.theme.id}/**/*.{html,liquid,md}`,
147
153
  `${rootPathPackage}/dist/defaults/**/_layouts/themes/${config.theme.id}/**/*.{html,liquid,md}`,
@@ -168,34 +174,6 @@ function sass(complete) {
168
174
  'src/assets/js/**/*.js',
169
175
  ];
170
176
 
171
- // // Log the files that will be analyzed
172
- // logger.log('PurgeCSS content patterns:', contentPatterns);
173
-
174
- // // Separate inclusion and exclusion patterns for glob
175
- // const includePatterns = contentPatterns.filter(p => !p.startsWith('!'));
176
- // const excludePatterns = contentPatterns.filter(p => p.startsWith('!')).map(p => p.substring(1));
177
-
178
- // // Use glob to get the actual files (respecting exclusions)
179
- // const allFiles = glob(includePatterns, { ignore: excludePatterns });
180
-
181
- // logger.log(`PurgeCSS will analyze ${allFiles.length} total files:`);
182
-
183
- // // Group files by type for better readability
184
- // const fileGroups = {
185
- // 'HTML/Liquid/MD files': allFiles.filter(f => /\.(html|liquid|md)$/.test(f)),
186
- // 'JavaScript files': allFiles.filter(f => /\.js$/.test(f))
187
- // };
188
-
189
- // Object.entries(fileGroups).forEach(([groupName, files]) => {
190
- // if (files.length > 0) {
191
- // logger.log(` ${groupName}: ${files.length} files`);
192
- // // Show first 5 files as examples
193
- // files.forEach(file => {
194
- // logger.log(` - ${file}`);
195
- // });
196
- // }
197
- // });
198
-
199
177
  // Apply PurgeCSS
200
178
  const purgeCssPlugin = purgeCss({
201
179
  content: contentPatterns,
@@ -275,6 +253,9 @@ function sass(complete) {
275
253
  // Social
276
254
  /^social-share-/,
277
255
 
256
+ // Third-party injected elements
257
+ /^grecaptcha/,
258
+
278
259
  // User-defined safelist from ultimate-jekyll-manager.json
279
260
  ...(ujmConfig?.sass?.purgecss?.safelist?.standard || []).map(s => new RegExp(s)),
280
261
  ],
@@ -307,11 +288,16 @@ function sass(complete) {
307
288
  ...(ujmConfig?.sass?.purgecss?.safelist?.keyframes || []).map(s => new RegExp(s)),
308
289
  ]
309
290
  },
310
- // Don't remove CSS variables
311
- variables: true,
312
- // Keep keyframes
291
+ // Exclusion patterns (! patterns don't work in content array, see note above)
292
+ skippedContentGlobs,
293
+ // PurgeCSS option naming: true = "yes, purge this category", false = "leave it alone"
294
+ // Disable CSS variable purging — page-specific CSS sets variables
295
+ // (e.g., --bs-btn-bg) that are only consumed by the main bundle,
296
+ // so per-file purging falsely removes them
297
+ variables: false,
298
+ // Purge unused @keyframes (safe — self-contained within a single file)
313
299
  keyframes: true,
314
- // Keep font-face rules
300
+ // Purge unused @font-face rules
315
301
  fontFace: true
316
302
  });
317
303
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-jekyll-manager",
3
- "version": "0.0.266",
3
+ "version": "0.0.268",
4
4
  "description": "Ultimate Jekyll dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {