diff --git a/assets/styles/objects/_grid.scss b/assets/styles/objects/_grid.scss index b1185dd..70f432f 100644 --- a/assets/styles/objects/_grid.scss +++ b/assets/styles/objects/_grid.scss @@ -3,19 +3,20 @@ // ========================================================================== // Help: https://css-tricks.com/snippets/css/complete-guide-grid/ // -// How to use : /** -*```html -*
-*
-*

Hello

-*
-*
-*

Hello

-*
-*
-* ``` -**/ + * Usage: + * + * ```html + *
+ *
+ *

Hello

+ *
+ *
+ *

Hello

+ *
+ *
+ * ``` + */ .o-grid { display: grid; diff --git a/build/tasks/styles.js b/build/tasks/styles.js index 256597b..29884cb 100644 --- a/build/tasks/styles.js +++ b/build/tasks/styles.js @@ -146,7 +146,7 @@ export default async function compileStyles(sassOptions = null, postcssOptions = await writeFile(outfile, result.css).then(() => { // Purge CSS once file exists. if (outfile) { - purgeUnusedCSS(outfile, filestem); + purgeUnusedCSS(outfile, `${label || `${filestem}.css`}`); } }); @@ -220,33 +220,35 @@ function createPostCSSProcessor(pluginsListOrMap, options) } /** - * Purge unused styles of minified CSS files. + * Purge unused styles from CSS files. * * @async * - * @param {string} outfile - The path of the CSS file. - * @param {string} filestem - The CSS file name. + * @param {string} outfile - The path of a css file + * If missing the function stops. + * @param {string} label - The CSS file label or name. + * @return {Promise} */ -async function purgeUnusedCSS(outfile, filestem) { - +async function purgeUnusedCSS(outfile, label) { + label = label ?? basename(outfile); const timeLabel = `${filestem}.css purged in`; - console.time(timeLabel); + console.time(timeLabel); const purgeCSSContentFiles = Array.from(loconfig.tasks.purgeCSS.content); const purgeCSSResults = await new PurgeCSS().purge({ content: purgeCSSContentFiles, - css: [outfile], + css: [ outfile ], rejected: true, defaultExtractor: content => content.match(/[a-z0-9_\-\\\/\@]+/gi) || [], safelist: { - standard: [/^((?!\bu-gc-).)*$/] + standard: [ /^((?!\bu-gc-).)*$/ ] } }) for(let result of purgeCSSResults) { await writeFile(outfile, result.css) - message(`${filestem}.css purged`, 'chore', timeLabel); + message(`${label} purged`, 'chore', timeLabel); } } diff --git a/docs/grid.md b/docs/grid.md index 31afb90..253c3b1 100644 --- a/docs/grid.md +++ b/docs/grid.md @@ -1,12 +1,10 @@ # Grid system -* [Architectures](#architectures) - * [Styles](#styles) +* [Architectures](#architecture) * [Build tasks](#build-tasks) - * [Config file](#config-file) + * [Configuration](#configuration) * [Usage](#usage) * [Example](#example) -* [Limitations](#limitations) ## Architecture