{"id":11669,"date":"2022-06-04T14:46:22","date_gmt":"2022-06-04T14:46:22","guid":{"rendered":"https:\/\/www.htmlgoodies.com\/?p=11669"},"modified":"2022-06-04T14:47:27","modified_gmt":"2022-06-04T14:47:27","slug":"css-values-less-variables-angular","status":"publish","type":"post","link":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/","title":{"rendered":"Setting CSS Values from Less Variables in Angular"},"content":{"rendered":"

Angular supports several of the most popular CSS preprocessors, including Scss, Sass, and Less, via the Angular CLI (Command Line Interface). Whenever web developers create a new app, the Angular CLI will prompt you to choose between vanilla CSS and a preprocessor. Should you choose to employ a preprocessor, Angular will compile to CSS automatically as part of the build process.<\/p>\n

However, if you use Webpack<\/a> or similar app bundling tool, you will have to manually install plugins and set up the necessary configuration to facilitate CSS compilation according to your chosen preprocessor. This can make integrating a CSS preprocessor into your web app a real hassle. Moreover, if you employ variables that dynamically set CSS values at run-time, it might make sense to compile styles within the app itself. In this web development tutorial, we will modify this<\/a> existing Angular app to read in color variables from a Less file and assign the compiled CSS attribute values to some class variables.<\/p>\n

You might also want to check out our web programming tutorial on Color Manipulation with JavaScript<\/a>.<\/p>\n

Customizing Theme Colors<\/h2>\n

A couple of good reasons for choosing a CSS preprocessor like Less (short for “Leaner Style Sheets”) is its support for custom variables and numerous functions like lighten()<\/strong> and darken()<\/strong>. These two features allow us to define some color properties like these in a .less<\/strong> file:<\/p>\n

@BackgroundColor: rgb(82, 172, 240);\r\n@HoverColor: lighten(@BackgroundColor, 20%);\r\n@FocusBorderColor: gray;\r\n<\/pre>\n

We can then reference our variables from our CSS rules like so:<\/p>\n

.background {\r\n  background-color: @BackgroundColor;\r\n}\r\n\r\n.hover-background {\r\n  background-color: @HoverColor;\r\n}\r\n\r\n.focus-border-background {\r\n  background-color: @FocusBorderColor;\r\n}\r\n<\/pre>\n

This provides a simple mechanism for changing an app’s color theme by swapping out one variables.less file with another.<\/p>\n

The two code snippets will be combined into the following CSS rules when compiled:<\/p>\n

.background {\r\n  background-color: #52acf0;\r\n}\r\n.hover-background {\r\n  background-color: #b0d9f8;\r\n}\r\n.focus-border-background {\r\n  background-color: gray;\r\n}<\/pre>\n

Our CSS tutorial, Working with CSS Variables<\/a>, goes into greater detail on how to use variables in CSS.<\/p>\n

Reading Asset Files from an Angular Application<\/h2>\n

By default, Angular has an asset directory, located under the \/src<\/strong> folder at the root<\/strong> of your project, which is copied over to the build directory by Angular CLI during the build process. It is where you put all application resources – anything from images, videos, and .json files to styles and scripts. It is defined under the “assets<\/strong>” section of the angular.json<\/strong> file:<\/p>\n

\"architect\": {\r\n  \"build\": {\r\n    \"builder\": \"@angular-devkit\/build-angular:browser\",\r\n    \"options\": {\r\n      \"outputPath\": \"dist\/angular-theme-changer\",\r\n      \"index\": \"src\/index.html\",\r\n      \"main\": \"src\/main.ts\",\r\n      \"polyfills\": \"src\/polyfills.ts\",\r\n      \"tsConfig\": \"tsconfig.app.json\",\r\n      \"assets\": [\r\n        \"src\/favicon.ico\",\r\n        \"src\/assets\"\r\n      ],\r\n      \"styles\": [\r\n        \"src\/styles.scss\"\r\n      ],\r\n      \"scripts\": []\r\n    },\r\n    \"configurations\": {\r\n    \/\/ ...\r\n<\/pre>\n

You can also add instructions to copy over files from a common library in the node_modules<\/strong> folder if you need to:<\/p>\n

\"assets\": [\r\n  \"src\/favicon.ico\",\r\n  \"src\/assets\",\r\n  {\r\n    \"glob\": \"**\/*\",\r\n    \"input\": \".\/node_modules\/@acme\/common-assets\/css\/\",\r\n    \"output\": \".\/assets\/\"\r\n  }\r\n<\/pre>\n

We will store our three color variables in the variables.less<\/strong> file, which we will create in the src\/assets<\/strong> folder of our project so that we can access them later:<\/p>\n

\"CSS<\/p>\n

 <\/p>\n

There are a few ways to read files in TypeScript\/JavaScript, but I would recommend Angular’s HttpClient<\/strong> class. It is specifically for communicating with a server over the HTTP protocol. To use it, we can import the HttpClient<\/strong> service class from @angular\/common\/http<\/strong> and inject it as a constructor argument. Its get()<\/strong> method takes two arguments: the endpoint URL from which to fetch, and an options object that is used to configure the request. If web developer do not specify any options, get()<\/strong> expects the response body to contain JSON data. Since that is not the case here, we need to specify a responseType<\/i><\/strong> of “text<\/strong>“.<\/p>\n

The get()<\/strong> method returns an Observable that we can subscribe to and process the file contents:<\/p>\n

import { HttpClient } from '@angular\/common\/http';\r\n\r\nexport class AppComponent {\r\n  constructor(http: HttpClient) {\r\n    http.get('.\/assets\/variables.less', {responseType: 'text'})\r\n    .pipe(first())\r\n    .subscribe(\r\n      variables => {\r\n      \/\/ Process the variables here... \r\n    },\r\n    err => {\r\n      console.log(err);\r\n    });\r\n  }\r\n}<\/pre>\n

Read:<\/strong> HTML, CSS, and JavaScript Tools and Libraries<\/a><\/p>\n

Converting Less Variables to a JS Object<\/h2>\n

Rather than try to parse the contents of the variables.less<\/strong> file ourselves, we can utilize less-vars-to-js<\/a> library to convert our variables to JavaScript (JS). Specifically designed for Less variables, it converts ours to the following JS object:<\/p>\n

{\r\n  @BackgroundColor: \"rgb(82, 172, 240)\"\r\n  @FocusBorderColor: \"gray\"\r\n  @HoverColor: \"lighten(@BackgroundColor, 20%)\"\r\n}\r\n<\/pre>\n

It can be invoked directly, without a constructor, as it only does one thing. We just need to pass in the Less variables string within the http.get’s<\/strong> subscribe callback:<\/p>\n

import lessToJs from 'less-vars-to-js';\r\n\r\n\/\/ ...\r\nvariables => {\r\n  let vars: Object;\r\n  try {\r\n    vars = lessToJs(variables);\r\n  } catch(err) {\r\n    console.log(err);\r\n    return;\r\n  } \r\n<\/pre>\n

Setting the CSS Values from the Less Variables Object<\/h2>\n

If you look at the generated JS Object, you’ll notice that Less functions like lighten() are not compiled by the lessToJs()<\/strong> function. That’s because less-vars-to-js<\/a> is just a Less variable parser and not a Less processor. To compile Less functions into actual color values, we need to use the official, stable version of the Less npm JS library<\/a>. Its methods may be invoked from the command-line, or, as in our case, programmatically. The main entry point into less is the less.render()<\/strong> function, which takes the following formats:<\/p>\n

less.render(lessInput[, options])\r\n  .then(function(output) {\r\n    \/\/ output.css = string of css\r\n    \/\/ output.map = string of sourcemap\r\n    \/\/ output.imports = array of string filenames of the imports referenced\r\n  },\r\n  function(error) {\r\n  });\r\n\/\/ or... less.render(css, options, function(error, output) {})\r\n<\/pre>\n

We will be using the first syntax.<\/p>\n

Although the options are not required, we will need to supply the modifyVars<\/strong> attribute in order to enable run-time modification of Less variables. It accepts a JS Object like the following:<\/p>\n

{ '@buttonFace': '#5B83AD', '@buttonText': '#D9EEF2' }\r\n<\/pre>\n

The lessInput<\/strong> argument needs to be in the format of Less rules and not variable declarations. The last thing we want to do is go hunting through all of our stylesheets for rules that use the color variables. In fact, that would be counterproductive, because we are only interested in the compiled color values and nothing else. For that, we can just wrap them in some dummy rules:<\/p>\n

let dummyCssRules = '', i = 0;\r\nfor (const [key, value] of Object.entries(vars)) {\r\n  dummyCssRules += 'rule' + ++i + ' { color: ' + key + '; }\\n';\r\n}\r\n<\/pre>\n

Now we have got three valid CSS rules that incorporate the Less color variables:<\/p>\n

rule1 { color: @BackgroundColor; }\r\nrule2 { color: @HoverColor; }\r\nrule3 { color: @FocusBorderColor; }\r\n<\/pre>\n

The less render()<\/strong> method returns a Promise with an Object that contains, among other things, the compiled CSS string:<\/p>\n

const options = { modifyVars: vars };\r\nless.render(dummyCssRules, options)\r\n  .then((cssObject) => {\r\n\t\/\/ set the theme colors...\r\n  })\r\n  .catch((reason) => console.error(reason));\r\n<\/pre>\n

Upon encountering @HoverColor’s<\/strong> value of “lighten(@BackgroundColor, 20%)<\/strong>“, Less readily sets the value to lighten’s results:<\/p>\n

rule1: {color: '#52acf0'}\r\nrule2: {color: '#b0d9f8'}\r\nrule3: {color: 'gray'}<\/pre>\n

Read:<\/strong> Introduction to CSS-in-JS<\/a><\/p>\n

Assigning the CSS Colors to Component Variables<\/h2>\n

Recall that the goal of all this is to call the App Component’s existing setColors()<\/strong> method with the three theme color values. To do that, we’ve got one more conversion to do if we are to access the CSS rule values. Again, we should rely on a library rather than parse the CSS ourselves. A good CSS to JS converter is available to us from none other than American Express (as in the credit card). They have a few repos on GitHub, including one for the css-to-js<\/a> library. It takes CSS rules in a string format and converts them to a JS Object like this one:<\/p>\n

{\r\n  rule1: {\r\n    color: \"#52acf0\"\r\n  }\r\n  rule2: {\r\n    color: \"#b0d9f8\"\r\n  }\r\n  rule3: {\r\n    color: \"gray\"\r\n  }\r\n}\r\n<\/pre>\n

All that is left to do now is invoke setColors()<\/strong> with our object attributes:<\/p>\n

import { convert } from '@americanexpress\/css-to-js';\r\n\r\n\/\/ In the Component constructor...\r\nconst compiledCssObject = convert(cssObject.css);\r\n\/\/ Set default colors\r\nthis.setColors(\r\n  compiledCssObject.rule1.color, \r\n  compiledCssObject.rule2.color, \r\n  compiledCssObject.rule3.color\r\n);\r\n<\/pre>\n

You can take a look at the demo to see how all of the above code works together.<\/p>\n

Final Thoughts on CSS Variables<\/h2>\n

This web development tutorial presented a few good JS libraries for converting between Less, CSS and JS, which we put to good use by setting some custom theme colors. As we will see in the next article, we can fetch entire Less stylesheets in much the same way, allowing us to entirely separate theme styles from our application.<\/p>\n

Read more CSS web development and programming tutorials<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"

Angular supports several of the most popular CSS preprocessors, including Scss, Sass, and Less, via the Angular CLI (Command Line Interface). Whenever web developers create a new app, the Angular CLI will prompt you to choose between vanilla CSS and a preprocessor. Should you choose to employ a preprocessor, Angular will compile to CSS automatically […]<\/p>\n","protected":false},"author":90,"featured_media":11671,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[30588,30620],"tags":[8817,31647,4810,5125,3385],"b2b_audience":[37],"b2b_industry":[65],"b2b_product":[69,70,71,76,131,68,118,81,82,133,83,84,107,86,30818,93,94,99,114,115,116,85,522,117,80,128,98,135],"acf":[],"yoast_head":"\nSetting CSS Values from Less Variables in Angular | HTML Goodies<\/title>\n<meta name=\"description\" content=\"This web development tutorial show web developers how to set CSS values from Less variables in Angular. Learn more CSS now.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting CSS Values from Less Variables in Angular | HTML Goodies\" \/>\n<meta property=\"og:description\" content=\"This web development tutorial show web developers how to set CSS values from Less variables in Angular. Learn more CSS now.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/\" \/>\n<meta property=\"og:site_name\" content=\"HTML Goodies\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-04T14:46:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-04T14:47:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2022\/06\/CSS-web-development-tutorial.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1500\" \/>\n\t<meta property=\"og:image:height\" content=\"1000\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@htmlgoodies\" \/>\n<meta name=\"twitter:site\" content=\"@htmlgoodies\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rob Gravelle\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.htmlgoodies.com\/#organization\",\"name\":\"HTML Goodies\",\"url\":\"https:\/\/www.htmlgoodies.com\/\",\"sameAs\":[\"https:\/\/twitter.com\/htmlgoodies\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.htmlgoodies.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2021\/03\/HTMLg_weblogo_MobileLogo.png\",\"contentUrl\":\"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2021\/03\/HTMLg_weblogo_MobileLogo.png\",\"width\":584,\"height\":136,\"caption\":\"HTML Goodies\"},\"image\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.htmlgoodies.com\/#website\",\"url\":\"https:\/\/www.htmlgoodies.com\/\",\"name\":\"HTML Goodies\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.htmlgoodies.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#primaryimage\",\"url\":\"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2022\/06\/CSS-web-development-tutorial.png\",\"contentUrl\":\"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2022\/06\/CSS-web-development-tutorial.png\",\"width\":1500,\"height\":1000,\"caption\":\"Web development tutorial\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#webpage\",\"url\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/\",\"name\":\"Setting CSS Values from Less Variables in Angular | HTML Goodies\",\"isPartOf\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#primaryimage\"},\"datePublished\":\"2022-06-04T14:46:22+00:00\",\"dateModified\":\"2022-06-04T14:47:27+00:00\",\"description\":\"This web development tutorial show web developers how to set CSS values from Less variables in Angular. Learn more CSS now.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.htmlgoodies.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setting CSS Values from Less Variables in Angular\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/#\/schema\/person\/d340101131281902e682ad0190b7ac75\"},\"headline\":\"Setting CSS Values from Less Variables in Angular\",\"datePublished\":\"2022-06-04T14:46:22+00:00\",\"dateModified\":\"2022-06-04T14:47:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#webpage\"},\"wordCount\":1102,\"publisher\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2022\/06\/CSS-web-development-tutorial.png\",\"keywords\":[\"Angular\",\"color\",\"CSS\",\"HTTP\",\"JavaScript\"],\"articleSection\":[\"CSS\",\"Javascript\"],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.htmlgoodies.com\/#\/schema\/person\/d340101131281902e682ad0190b7ac75\",\"name\":\"Rob Gravelle\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.htmlgoodies.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2021\/05\/rob-gravelle-150x150.jpg\",\"contentUrl\":\"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2021\/05\/rob-gravelle-150x150.jpg\",\"caption\":\"Rob Gravelle\"},\"description\":\"Rob Gravelle resides in Ottawa, Canada, and has been an IT guru for over 20 years. In that time, Rob has built systems for intelligence-related organizations such as Canada Border Services and various commercial businesses. In his spare time, Rob has become an accomplished music artist with several CDs and digital releases to his credit.\",\"url\":\"https:\/\/www.htmlgoodies.com\/author\/rob-gravelle\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Setting CSS Values from Less Variables in Angular | HTML Goodies","description":"This web development tutorial show web developers how to set CSS values from Less variables in Angular. Learn more CSS now.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/","og_locale":"en_US","og_type":"article","og_title":"Setting CSS Values from Less Variables in Angular | HTML Goodies","og_description":"This web development tutorial show web developers how to set CSS values from Less variables in Angular. Learn more CSS now.","og_url":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/","og_site_name":"HTML Goodies","article_published_time":"2022-06-04T14:46:22+00:00","article_modified_time":"2022-06-04T14:47:27+00:00","og_image":[{"width":1500,"height":1000,"url":"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2022\/06\/CSS-web-development-tutorial.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_creator":"@htmlgoodies","twitter_site":"@htmlgoodies","twitter_misc":{"Written by":"Rob Gravelle","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/www.htmlgoodies.com\/#organization","name":"HTML Goodies","url":"https:\/\/www.htmlgoodies.com\/","sameAs":["https:\/\/twitter.com\/htmlgoodies"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.htmlgoodies.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2021\/03\/HTMLg_weblogo_MobileLogo.png","contentUrl":"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2021\/03\/HTMLg_weblogo_MobileLogo.png","width":584,"height":136,"caption":"HTML Goodies"},"image":{"@id":"https:\/\/www.htmlgoodies.com\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/www.htmlgoodies.com\/#website","url":"https:\/\/www.htmlgoodies.com\/","name":"HTML Goodies","description":"","publisher":{"@id":"https:\/\/www.htmlgoodies.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.htmlgoodies.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#primaryimage","url":"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2022\/06\/CSS-web-development-tutorial.png","contentUrl":"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2022\/06\/CSS-web-development-tutorial.png","width":1500,"height":1000,"caption":"Web development tutorial"},{"@type":"WebPage","@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#webpage","url":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/","name":"Setting CSS Values from Less Variables in Angular | HTML Goodies","isPartOf":{"@id":"https:\/\/www.htmlgoodies.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#primaryimage"},"datePublished":"2022-06-04T14:46:22+00:00","dateModified":"2022-06-04T14:47:27+00:00","description":"This web development tutorial show web developers how to set CSS values from Less variables in Angular. Learn more CSS now.","breadcrumb":{"@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.htmlgoodies.com\/"},{"@type":"ListItem","position":2,"name":"Setting CSS Values from Less Variables in Angular"}]},{"@type":"Article","@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#article","isPartOf":{"@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#webpage"},"author":{"@id":"https:\/\/www.htmlgoodies.com\/#\/schema\/person\/d340101131281902e682ad0190b7ac75"},"headline":"Setting CSS Values from Less Variables in Angular","datePublished":"2022-06-04T14:46:22+00:00","dateModified":"2022-06-04T14:47:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#webpage"},"wordCount":1102,"publisher":{"@id":"https:\/\/www.htmlgoodies.com\/#organization"},"image":{"@id":"https:\/\/www.htmlgoodies.com\/css\/css-values-less-variables-angular\/#primaryimage"},"thumbnailUrl":"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2022\/06\/CSS-web-development-tutorial.png","keywords":["Angular","color","CSS","HTTP","JavaScript"],"articleSection":["CSS","Javascript"],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.htmlgoodies.com\/#\/schema\/person\/d340101131281902e682ad0190b7ac75","name":"Rob Gravelle","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.htmlgoodies.com\/#\/schema\/person\/image\/","url":"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2021\/05\/rob-gravelle-150x150.jpg","contentUrl":"https:\/\/www.htmlgoodies.com\/wp-content\/uploads\/2021\/05\/rob-gravelle-150x150.jpg","caption":"Rob Gravelle"},"description":"Rob Gravelle resides in Ottawa, Canada, and has been an IT guru for over 20 years. In that time, Rob has built systems for intelligence-related organizations such as Canada Border Services and various commercial businesses. In his spare time, Rob has become an accomplished music artist with several CDs and digital releases to his credit.","url":"https:\/\/www.htmlgoodies.com\/author\/rob-gravelle\/"}]}},"_links":{"self":[{"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/posts\/11669"}],"collection":[{"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/users\/90"}],"replies":[{"embeddable":true,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/comments?post=11669"}],"version-history":[{"count":0,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/posts\/11669\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/media\/11671"}],"wp:attachment":[{"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/media?parent=11669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/categories?post=11669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/tags?post=11669"},{"taxonomy":"b2b_audience","embeddable":true,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/b2b_audience?post=11669"},{"taxonomy":"b2b_industry","embeddable":true,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/b2b_industry?post=11669"},{"taxonomy":"b2b_product","embeddable":true,"href":"https:\/\/www.htmlgoodies.com\/wp-json\/wp\/v2\/b2b_product?post=11669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}