1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00

Apply suggestions from code review

Co-authored-by: Chauncey McAskill <chauncey@mcaskill.ca>
This commit is contained in:
Deven Caron
2022-06-06 16:30:59 -04:00
committed by GitHub
parent 8d1b548ad0
commit 8b0926269a
3 changed files with 27 additions and 26 deletions

View File

@@ -3,8 +3,9 @@
// ==========================================================================
// Help: https://css-tricks.com/snippets/css/complete-guide-grid/
//
// How to use :
/**
* Usage:
*
* ```html
* <div class="o-grid -col-4 -col-12@from-medium -gutters">
* <div class="o-grid_item u-gc-1/2 u-gc-3/9@from-medium">
@@ -15,7 +16,7 @@
* </div>
* </div>
* ```
**/
*/
.o-grid {
display: grid;

View File

@@ -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,15 +220,17 @@ 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);
@@ -247,6 +249,6 @@ async function purgeUnusedCSS(outfile, filestem) {
for(let result of purgeCSSResults) {
await writeFile(outfile, result.css)
message(`${filestem}.css purged`, 'chore', timeLabel);
message(`${label} purged`, 'chore', timeLabel);
}
}

View File

@@ -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