css 一个PostCSS插件,以保持CSS网格简单愚蠢

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 一个PostCSS插件,以保持CSS网格简单愚蠢相关的知识,希望对你有一定的参考价值。

body {
	grid-kiss:
		"+-------------------------------+      "
		"|           header ↑            | 120px"
		"+-------------------------------+      "
		"                                       "
		"+-- 30% ---+  +--- auto --------+      "
		"| .sidebar |  |       main      | auto "
		"+----------+  +-----------------+      "
		"                                       "
		"+-------------------------------+      "
		"|              ↓                | 60px "
		"|         → footer ←            |      "
		"+-------------------------------+      "
}

// is converted to:

body > header {
	grid-area: header;
	align-self: start
}

body > .sidebar {
	grid-area: sidebar
}

body > main {
	grid-area: main
}

body > footer {
	grid-area: footer;
	justify-self: center;
	align-self: end
}

body {
	display: grid;
	align-content: space-between;
	grid-template-rows: 120px 1fr 60px;
	grid-template-columns: 30% 1fr;
	grid-template-areas: 
	"header  header"
	"sidebar main  "
	"footer  footer"
}

以上是关于css 一个PostCSS插件,以保持CSS网格简单愚蠢的主要内容,如果未能解决你的问题,请参考以下文章

postcss7和postcss8的差异

postcss7版本和8版本的差异

错误:加载 PostCSS 插件失败:令牌无效或意外(Vue.js、tailwind css)

PostCSS理解与运用

深入浅出的webpack构建工具---PostCss

如何结合gulp使用postcss