scss

使用vue搭建应用三引入scss

回眸只為那壹抹淺笑 提交于 2019-12-04 13:16:02
Css、Sass、Scss的含义及区别 Css(Cascading Style Sheets)   层叠样式表 Sass(Syntactically Awesome StyleSheets)   是一款强化 CSS 的辅助工具,它在 CSS 语法的基础上增加了变量 (variables)、嵌套 (nested rules)、混合 (mixins)、导入 (inline imports) 等高级功能,这些拓展令 CSS 更加强大与优雅   使用 Sass 以及 Sass 的样式库有助于更好地组织管理样式文件,以及更高效地开发项目。 Scss(Sassy CSS)   是 Sass 3 引入新的语法,是Sassy CSS的简写,是CSS3语法的超集 不同之处:   文件扩展名不同:     Sass 是以“.sass”后缀为扩展名,     SCSS 是以“.scss”后缀为扩展名   语法书写方式不同:     Sass 是以严格的缩进式语法规则来书写,不带大括号({})和分号     SCSS的书写需要使用分号和花括号 sass #ABC width: 30% height:100% scss #ABC { width: 30%; height:100%; } 1.安装SCSS 编写页面样式会用到SCSS,安装 yarn add sass-loader node-sass 出现  

vue.config.js 配置 scss,less,sass全局配置 vuecli3

浪尽此生 提交于 2019-12-03 17:29:29
module.exports = { /* 部署生产环境和开发环境下的URL:可对当前环境进行区分,baseUrl 从 Vue CLI 3.3 起已弃用,要使用publicPath */ publicPath: process.env.NODE_ENV === 'production' ? '/public/' : '/', /* 输出文件目录:在npm run build时,生成文件的目录名称 */ outputDir: process.env.VUE_APP_FLAG, /* 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录 */ assetsDir: "assets", /* 是否在构建生产包时生成 sourceMap 文件,false将提高构建速度 */ productionSourceMap: false, /* 默认情况下,生成的静态资源在它们的文件名中包含了 hash 以便更好的控制缓存,你可以通过将这个选项设为 false 来关闭文件名哈希。(false的时候就是让原来的文件名不改变) */ filenameHashing: false, /* 代码保存时进行eslint检测 */ lintOnSave: true, /* 注意sass,scss,less的配置 */ css: { loaderOptions:

01项目准备工作

[亡魂溺海] 提交于 2019-12-03 17:08:27
1.字体图标准备    https://www.iconfont.cn/ 下载项目中需要的SVG图标    https://icomoon.io/app/#/select 在这个网站导入下载好的SVG图标,生成字体图标      这边的fonts是通过style.css来引用的,我习惯把style.css改成icon.css,然后在项目文件中src-->assets下新建一个styles目录,将fonts文件夹和icon.css复制进去。    接着在main.js中引入: import './assets/styles/icon.css'   测试:(可通过类名对图标进行大小颜色的设置)      结果成功展示:    2.项目依赖包下载+项目配置   1、安装sass:     npm install --save-dev node-sass sass-loader          此处用的node版本为10.14.1,如果是老版本下载的sass,在node高版本下会有兼容问题,请卸载sass重新安装。     卸载:npm uninstall --save-dev node-sass sass-loader 3.准备web字体   以前 CSS3 的版本,网页设计师不得不使用用户计算机上已经安装的字体。现在使用 CSS3 ,网页设计师可以使用他/她喜欢的任何字体。  

Proper SCSS Asset Structure in Rails

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So, I have an app/assets/stylesheets/ directory structure that looks something like this: |-dialogs |-mixins |---buttons |---gradients |---vendor_support |---widgets |-pages |-structure |-ui_elements In each directory, there are multiple sass partials (usually *.css.scss, but one or two *.css.scss.erb). I might be assuming a lot, but rails SHOULD automatically compile all the files in those directories because of *= require_tree . in application.css, right? I recently have tried restructuring these files by removing all color variables and

Using SCSS/Sass as default style sheet in Angular 6+ (styleExt)

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Apparently the way to declare the default stylesheet extension changed from Angular 6 onwards. The styleExt property in the angular-cli.json is not recognised any longer. For new projects this can be set with an option on the CLI --style=sass on the new command. However, how do you change this for exsting projects that I migrate from Angular <5 or if you forgot to do this during project creation? This question is meant to be strictly related to the breaking changes by the version 5 to 6 of Angular. 回答1: The position on which this is set

vue.js: always load a settings.scss file in every vue style section

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I find myself repeating this same pattern in every .vue file, in order to use variables, etc.: */ /*--> */ or if it's nested in a folder I have to remember to be careful with the path: */ /*--> */ Is there a way to globally import that settings.scss file in every .vue file I create? I looked in the docs and didn't see it, but maybe I missed it, or maybe this is something I need to leverage webpack to do? 回答1: I reckon you're using webpack? You can require the settings.scss file in your app.js file something like this require ( "

Angular CLI SASS options

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm new to Angular and I'm coming from the Ember community. Trying to use the new Angular-CLI based off of Ember-CLI. I need to know the best way to handle SASS in a new Angular project. I tried using the ember-cli-sass repo to see if it would play along since a number of core components of the Angular-CLI are run off of Ember-CLI modules. It didnt work but than again not sure if I just misconfigured something. Also, what is the best way to organize styles in a new Angular project? It would be nice to have the sass file in the same

How to compile or convert sass / scss to css with node-sass (no Ruby)?

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was struggling with setting up libsass as it wasn't as straight-forward as the Ruby based transpiler. Could someone explain how to: install libsass? use it from command line? use it with task runners like gulp and grunt? I have little experience with package managers and even less so with task runners. 回答1: I picked node-sass implementer for libsass because it is based on node.js. Installing node-sass (Prerequisite) If you don't have npm, install Node.js first. $ npm install -g node-sass installs node-sass globally -g . This will hopefully

Meaning of ~ in import of scss files

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a npm library that I use for styling which uses the following syntax to import scss files. I am not sure what this means and could not find any documentation online. I use grunt with webpack during my build process. @import '~bourbon/app/assets/stylesheets/bourbon'; @import '~bourbon-neat'; 回答1: From documentation on a sass-loader#imports project, webpack provides an advanced mechanism to resolve files. The sass-loader uses node-sass' custom importer feature to pass all queries to the webpack resolving engine. Thus you can import your

Import css/scss file into a class

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a problem. I'm using vaadin inside liferay. I've successfully written a fully responsive (yeah, tables too) theme for vaadin, based on bootstrap. Now I'm importing it to liferay. Everything went fine 'till I needed to upgrade Liferay, where their new responsive theme is using same classes name as bootstrap, but with different behaviour (sad, very sad face). The solution I've thought so far is to apply a class to the vaadin compiled css, like: .daVaadinTheme { @import bootstrap.css; } so the content will be compiled like: