Sass

sass npm 安装使用小记

删除回忆录丶 提交于 2020-07-28 13:28:12
npm 安装sass cnpm i sass -g 查看sass版本信息 sass -version 使用sass sass 是css的预处理器,是css扩展语言,可以帮助我们减少css重复的代码,sass扩展了css3,增加了规则 变量 混入 选择器 继承 内置函数等等特性。文件后缀为.scss; sass变量可以存储以下信息: 字符串 数字 颜色值 布尔值 列表 null值 sass变量使用$符号: $variablename:value; $primary:blue; 这是全局变量 !global 设置局部变量为全局的 h1 { $myColor : green !global ; } 注意:所有的全局变量我们一般定义在同一个文件中,可以使用@include来包含该文件 Sass的嵌套规则选择器类似于HTML的嵌套规则 Sass嵌套属性 很多css属性都有同样的属性,可以使用嵌套属性来编写它们: demo: 编译后: Sass @import Sass可以帮助我们减少css重复代码,节省开发时间。 我们可以安装不同的属性来创建一些代码文件,如:变量定义的文件 颜色定义的文件 字体相关的文件等。 Sass导入文件 类似css,sass支持@import指令 @import指令可以让我们导入其他文件等内容。 css @import指令在妹子调用时,都会创建一个额外deHTTP请求

vue2.0以上版本安装sass(scss) 、vue项目启动出现cannot GET /服务错误

安稳与你 提交于 2020-07-26 17:08:35
vue项目启动出现cannot GET /服务错误 查看控制台 是一些sass相关库没安装成功 进行下面操作进行安装,再次启动,完美解决! 一、首先说明sass和scss的区别。 1、异同:1)简言之可以理解scss是sass的一个升级版本,完全兼容sass之前的功能,又有了些新增能力。语法形式上有些许不同,最主要的就是sass是靠缩进表示嵌套关系,scss是花括号      2)文件扩展名不同,Sass 是以“.sass”后缀为扩展名,而 SCSS 是以“.scss”后缀为扩展名      3)语法书写方式不同,Sass 是以严格的缩进式语法规则来书写,不带大括号({})和分号(;),而 SCSS 的语法书写和我们的 CSS 语法书写方式非常类似。 //sass .father width:100px; .son width:50px; //scss .father{ width:100px; .son{ width:50px; } } 2、 scss功能很强大的样子,能做运算、写函数啥的,但是我只是作为语法糖用而已,只看了些基础功能 我个人常用的功能有: 嵌套 变量 $color : #111111; 混入 @mixin 继承 @extend 3、一个关于@mixin、@extend、%placeholder的适用场景总结 mixin 可以传变量 extend 不可以传变量

vsCode 扩展

生来就可爱ヽ(ⅴ<●) 提交于 2020-07-26 13:55:21
1. 名称: Auto Import ID: steoates.autoimport 说明: Automatically finds, parses and provides code actions and code completion for all available imports. Works with Typescript and TSX 版本: 1.5.3 发布者: steoates VS Marketplace 链接: https://marketplace.visualstudio.com/items?itemName=steoates.autoimport 2.名称: Beautify css/sass/scss/less ID: michelemelluso.code-beautifier 说明: Beautify css, sass and less code (extension for Visual Studio Code) 版本: 2.3.3 发布者: michelemelluso VS Marketplace 链接: https://marketplace.visualstudio.com/items?itemName=michelemelluso.code-beautifier 3.名称: Bluloco Dark Theme ID: uloco

SASS 'Invalid css error' when using variable from imported module

非 Y 不嫁゛ 提交于 2020-07-22 17:37:44
问题 I'm really new to Sass and having problems when importing variables from partial stylesheets. I thought it was pretty straightforward, but it seems not to be the case. I'm using this stylesheet in a react component, importing like this: import '../stylesheets/Table.scss'; The actual stylesheet (simplified, but with the same error) looks like this: @use 'colors.scss'; .datatb-container { background-color: colors.$table-bg; border: 2px solid colors.$table-border; border-radius: 2px; padding: 1

SASS 'Invalid css error' when using variable from imported module

£可爱£侵袭症+ 提交于 2020-07-22 17:37:42
问题 I'm really new to Sass and having problems when importing variables from partial stylesheets. I thought it was pretty straightforward, but it seems not to be the case. I'm using this stylesheet in a react component, importing like this: import '../stylesheets/Table.scss'; The actual stylesheet (simplified, but with the same error) looks like this: @use 'colors.scss'; .datatb-container { background-color: colors.$table-bg; border: 2px solid colors.$table-border; border-radius: 2px; padding: 1

ELIFECYCLE npm error

非 Y 不嫁゛ 提交于 2020-07-22 05:03:04
问题 This is the error in my console npm ERR! code ELIFECYCLE npm ERR! errno 3221225477 npm ERR! sedona@0.1.0 start: `npm run build && gulp serve` npm ERR! Exit status 3221225477 npm ERR! npm ERR! Failed at the sedona@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\User\AppData\Roaming\npm-cache\_logs\2017-07-21T19_40_30_516Z -debug.log This is the "debug

How to use a SASS $variable across multiple pages using @use?

故事扮演 提交于 2020-07-21 04:45:13
问题 I am trying to use a variable that was declared on one partial inside of another another partial, both of which will be loaded into the main.scss file using @use, which will then be compiled into css. Here's the setup: style.scss @use './global'; @use './header'; _global.scss $black: #262626; _header.scss header { color: $black } When I run try to compile style.css, I get this error: C:\xampp\htdocs\Site\styles>sass style.scss:style.css Error: Undefined variable. ╷ 3 │ color: $black; │ ^^^^^^

Inline SVG Disappears with Flexbox

六眼飞鱼酱① 提交于 2020-07-20 07:20:10
问题 I am trying to center an inline SVG element both vertically and horizontally using Flexbox. For some reason when I display: flex on the parent container, the inline SVG just disappears. body { background-color: #000; margin: 0; border: 0; outline: 0; } .flexbox-container { display: flex; align-items: center; justify-content: center; } <div class="flexbox-container"> <div> <svg id="logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 598.6 323.5"> <title>We Will Not Be Silent</title> <g>

Using css variables in sass functions - node-sass

你说的曾经没有我的故事 提交于 2020-07-20 07:12:28
问题 I am trying to use CSS variables in an Angular project together with Sass functions ( lighten() / darken() to be precise), and as far as I know, the latest version of LibSass allows it. I have installed node-sass@4.11.0 and sass-loader@7.1.0 (and on Angular v7.3.0), but yet I receive an error Argument $color of lighten($color, $amount) must be a color Am I missing something? Thanks! 回答1: Unfortunately you can't... lighten is a SASS function at compile-time, while CSS variables are run-time