Sass

Set sass variable value in Angular 7

只愿长相守 提交于 2020-05-26 11:10:09
问题 I have been working with angular for the last few weeks, and now I have a requirement to dynamically style a public site. The site admin set various color codes as well as a logo image from admin in a database. These will be reflected when the Public Site opens. As I am from an asp.net background, previously what I would do is on master page load, take values from the DB and write them into a .less file, and let java-script library take care of it. It's simple there. But for my current

Set sass variable value in Angular 7

|▌冷眼眸甩不掉的悲伤 提交于 2020-05-26 11:04:52
问题 I have been working with angular for the last few weeks, and now I have a requirement to dynamically style a public site. The site admin set various color codes as well as a logo image from admin in a database. These will be reflected when the Public Site opens. As I am from an asp.net background, previously what I would do is on master page load, take values from the DB and write them into a .less file, and let java-script library take care of it. It's simple there. But for my current

Autoprefixer in npm script show TypeError: Patterns must be a string or an array of strings

拈花ヽ惹草 提交于 2020-05-24 04:38:58
问题 When I run npm run prefix:css it show the TypeError: Patterns must be a string or an array of strings { "name": "natours", "version": "1.0.0", "description": "A natours project", "main": "index.js", "scripts": { "watch:sass": "node-sass sass/main.scss css/style.css -w", "compile:sass": "node-sass sass/main.scss css/style.comp.css", "concat:css": "concat -o css/style.concat.css css/icon-font.css css/style.comp.css", "prefix:css": "postcss --use autoprefixer -b 'last 10 versions' css/style

Is there any way to use sass instead of node-sass (default for sass-loader) in Nuxt.js?

痞子三分冷 提交于 2020-05-18 04:30:09
问题 I'm trying to use sass package instead of node-sass in Nuxt.js. I found a config like this; // vue.config.js module.exports = { css: { loaderOptions: { sass: { implementation: require('sass'), // This line must in sass option }, }, } } but I couldn't figure out where to put this code in Nuxt.js. 回答1: Its already pointed on documentation. nuxt.config.js : build: { ... loaders: { sass: { implementation: require('sass') }, scss: { implementation: require('sass') } } ... } 来源: https:/

VSCode warning on @use in scss file

此生再无相见时 提交于 2020-05-16 06:07:32
问题 I have an scss file that looks like this @use "colors"; .content { color: colors.$text; } This compiles fine with my current version of sass (I'm using dart-sass version v1.23.7) But VSCode shows 3 problems in the problems panel which looks a little like this It seems like I need to do something to update the underlying version of scss used but I can't for the life of me work out where this setting is? The details of one of these errors is: { "resource": "Untitled-1", "owner": "_generated

when to compile SASS

痴心易碎 提交于 2020-05-15 21:22:12
问题 I am new to web development. I have read about SCSS/SASS and I realized it is not what the browser looks for, so it should be compiled to pure CSS. My question is did I get it right: whenever I make a change to my SCSS file, I should then compile it and then see the result. whenever I want to update my website, I should have a special script on my server side to translate the new SCSS files to pure CSS and that happens only once per update. (The number of CSS files is high and I wish to keep

Scss theming depends on body class with predefined variables

╄→гoц情女王★ 提交于 2020-05-15 11:43:07
问题 I want to have checkbox which, when you clicked it add class to body tag for example like 'dark-theme' or 'light theme'. The problem is that theming requirment is appeared after i styled all elements, and it would be suicide to change each element styles now. Please help $color-white: #ffffff; $color-black: #000000; // Dark $color-green: #328332; $color-red: #a23232; $color-background-dark: #212734; $color-backgound-light: #31394c; $color-text: rgba(255, 255, 255, 0.3); $color-text-darker:

In React, how to prevent a component's CSS import from applying to the entire app?

心已入冬 提交于 2020-05-15 01:47:33
问题 I'm using facebook's create-react app for my application: In my Login.js container, I am importing CSS like so: import React from 'react'; import '../../styles/users/Login.css' const Login = () => { .... The problem is the Login.css styles are being applied to my entire application... for example, if Login.css has: body { background:Red ; } The entire app would have a body of background: Red; Even outside of the Login container. What I expected/want is for a CSS import within a container to

In React, how to prevent a component's CSS import from applying to the entire app?

末鹿安然 提交于 2020-05-15 01:45:01
问题 I'm using facebook's create-react app for my application: In my Login.js container, I am importing CSS like so: import React from 'react'; import '../../styles/users/Login.css' const Login = () => { .... The problem is the Login.css styles are being applied to my entire application... for example, if Login.css has: body { background:Red ; } The entire app would have a body of background: Red; Even outside of the Login container. What I expected/want is for a CSS import within a container to

Integrate node-sass-json-importer into an Angular CLI application

[亡魂溺海] 提交于 2020-05-14 15:54:11
问题 Trying to add the node-sass-json-importer into an Angular CLI application. I was using version 1.0.0-beta.17 of the CLI, but haven't been able to figure it out using the current version 1.2 either. After installing it via yarn I don't know where it should be setup in the application configuration. Has anyone successfully integrated this into their application? The only answer I could find regarding this is for applications using Webpack, but not for the Angular CLI. 回答1: Solved this by