Sass

How could I get the number of items in a dynamic list with Sass?

杀马特。学长 韩版系。学妹 提交于 2020-04-07 06:04:27
问题 <ul> <li></li> <li></li> <li></li> ... <li></li> </ul> Is it possible to get the 'n' value o the last item of a dinamic list with Sass? Like counting the number of items within the 'ul' using the @each or @for statements ? 回答1: No. Sass only compiles to CSS. It is never sent to the browser. It has no knowledge of the DOM. 来源: https://stackoverflow.com/questions/28129352/how-could-i-get-the-number-of-items-in-a-dynamic-list-with-sass

How could I get the number of items in a dynamic list with Sass?

℡╲_俬逩灬. 提交于 2020-04-07 06:04:00
问题 <ul> <li></li> <li></li> <li></li> ... <li></li> </ul> Is it possible to get the 'n' value o the last item of a dinamic list with Sass? Like counting the number of items within the 'ul' using the @each or @for statements ? 回答1: No. Sass only compiles to CSS. It is never sent to the browser. It has no knowledge of the DOM. 来源: https://stackoverflow.com/questions/28129352/how-could-i-get-the-number-of-items-in-a-dynamic-list-with-sass

使用css预处理器sass轻松生成margin、padding四个方向多个值的css样式代码

爷,独闯天下 提交于 2020-04-07 04:12:09
直接在scss文件上复制这段scss代码: $directions:("t":"top", "b":"bottom", "l":"left", "r":"right"); $dimensions:("p":"padding", "m":"margin"); //获取padding margin间隔 @each $dim in $dimensions { //循环四个方向 @each $dir in $directions { @for $i from 1 through 5 { $size: $i*5; .#{nth($dim,1)}-#{nth($dir,1)}-#{$size} { #{nth($dim,2)}-#{nth($dir,2)}: #{$size}px; } } } } 编译scss文件得到css文件,即可得到如下css代码: .p-t-5 { padding-top: 5px; } .p-t-10 { padding-top: 10px; } .p-t-15 { padding-top: 15px; } .p-t-20 { padding-top: 20px; } .p-t-25 { padding-top: 25px; } .p-b-5 { padding-bottom: 5px; } .p-b-10 { padding-bottom: 10px; } .p-b

Rotate Parent but not child on hover

岁酱吖の 提交于 2020-04-06 11:16:06
问题 The <figure> element should rotate on hover but not its child, the <img> . Using SCSS only. <figure> has a background slightly bigger than <img> so it gives a border effect. .about__image { margin: 4rem; width: 27rem; height: 27rem; float: left; -webkit-shape-outside: circle(50% at 50% 50%); shape-outside: circle(50% at 50% 50%); -webkit-clip-path: circle(50% at 50% 50%); clip-path: circle(50% at 50% 50%); position: relative; background-image: radial-gradient(at left top, red 25%, blue 55%);

Rotate Parent but not child on hover

天大地大妈咪最大 提交于 2020-04-06 11:15:59
问题 The <figure> element should rotate on hover but not its child, the <img> . Using SCSS only. <figure> has a background slightly bigger than <img> so it gives a border effect. .about__image { margin: 4rem; width: 27rem; height: 27rem; float: left; -webkit-shape-outside: circle(50% at 50% 50%); shape-outside: circle(50% at 50% 50%); -webkit-clip-path: circle(50% at 50% 50%); clip-path: circle(50% at 50% 50%); position: relative; background-image: radial-gradient(at left top, red 25%, blue 55%);

vue安装插件node-sass和sass-loader,识别scss文件

邮差的信 提交于 2020-04-06 10:17:15
1、安装插件 cnpm install --save-dev node-sass sass-loader@6.0.7 --save-dev 表示开发时用到的插件 sass-loader版本号其实没有限制,我这里用的是这个版本,你可以用不同版本,部分用法可能不一样,自己去找文档看 安装完成之后并不需要配置,这是因为vue中已经帮我们预留配置好了 build/utils.js 这就是vue帮我们配置好的内容 来源: oschina 链接: https://my.oschina.net/u/4261553/blog/3221428

Create angular material theme with CSS variables

旧街凉风 提交于 2020-04-06 02:43:26
问题 I am working on a project that requires to be themeable at runtime. So I created a theme system that combines SCSS variable with CSS Variables. This is how it looks. :root { --primary-color: 196; } // Primary $primary-100: hsl(var(--primary-color), 90%, 98%); $primary-400: hsl(var(--primary-color), 90%, 65%); $primary-main: hsl(var(--primary-color), 90%, 50%); $primary-700: hsl(var(--primary-color), 90%, 30%); $primary-900: hsl(var(--primary-color), 90%, 10%); While this works amazingly with

Trying to use sass modules in create-react-app with the new @use syntax but receiving an error

南笙酒味 提交于 2020-04-03 11:13:53
问题 I've npm installed the latest node-sass, and scss files work fine until I use @use. I have a _tokens.scss file in /shared/tokens/ folder. Within _tokens.scss I have: $colorwhite: #ffffff; In my root folder, my App.scss looks like this: @use "shared/tokens/tokens"; .App-header { color: tokens.$colorwhite; } But I am getting this error: ./src/App.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6

Trying to use sass modules in create-react-app with the new @use syntax but receiving an error

拥有回忆 提交于 2020-04-03 10:47:50
问题 I've npm installed the latest node-sass, and scss files work fine until I use @use. I have a _tokens.scss file in /shared/tokens/ folder. Within _tokens.scss I have: $colorwhite: #ffffff; In my root folder, my App.scss looks like this: @use "shared/tokens/tokens"; .App-header { color: tokens.$colorwhite; } But I am getting this error: ./src/App.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6

Trying to use sass modules in create-react-app with the new @use syntax but receiving an error

房东的猫 提交于 2020-04-03 10:47:45
问题 I've npm installed the latest node-sass, and scss files work fine until I use @use. I have a _tokens.scss file in /shared/tokens/ folder. Within _tokens.scss I have: $colorwhite: #ffffff; In my root folder, my App.scss looks like this: @use "shared/tokens/tokens"; .App-header { color: tokens.$colorwhite; } But I am getting this error: ./src/App.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6