autoprefixer
autoprefixer copied to clipboard
Can not find grid areas: intentional-left-blank
lets say I have a grid layout, where I want to draw ab H where certain regions are intentionally left blank:
.grid {
grid-gap: 1px;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
grid-template-areas: 'left top-void right'
'left center right'
'left bottom-void right'
}
.grid__left {
grid-area: left;
}
.grid__center {
grid-area: center;
}
.grid__right {
grid-area: right;
}
The build would produce the following warning
Can not find grid areas: top-void, bottom-void
But having empty grid areas is perfectly valid, isn't it? What should I do to solve this warning?
Non-used areas may be caused by mistake. It is better to explicitly mark them as empty.
We can add an option to hide this warning. Send PR.
But having empty grid areas is perfectly valid, isn't it?
You are right, it is perfectly valid.
What should I do to solve this warning?
I ran into this once in one of my own projects. I ended up working around the issue by just adding an empty <div>
to the page for each area I wanted to leave blank and assigned those divs to the empty areas. Not ideal but it worked.
We can add an option to hide this warning.
I think it would make more sense to have some sort of generic control comment for ignoring warnings.
That allows the warning to still take effect when it is a mistake but allows an explicit ignoring of the warning when it is intentional.
There are feasibily more instances where autoprefixer produces false positive warnings for other reasons. Having a control comment for ignoring warnings would solve more than just this issue.
I propose these two control comments
/* autoprefixer: warnings off */
Works the same way as /* autoprefixer: off */
except it just ignores all warnings instead of turning autoprefixer off completely.
/* autoprefixer: ignore next warning */
Ignores warnings that were generated by the next line of css that immediately follow this control comment.
/* autoprefixer: ignore next warning */
let’s use more words to avoid over-using.
Iike this?
/* autoprefixer: ignore all warnings */
And
/* autoprefixer: ignore all warnings on the next line */
/* autoprefixer: ignore next warning */
is enouph :)