The scss function is returning an invalid property value

In my Angular project, I have organized my scss files/folders in the following way:

1) Settings - containing color settings and functions for the project 2) Files and folders defining variables such as fonts, widths, etc. for components and pages
3) Files and folders using these variables for classes

The issue I'm facing is that the functions created in the settings file are not working and giving an error of invalid property value.

https://i.sstatic.net/gpEVd.png

_settings: loaded first

$brand-colours: (
    text:                       #2F2F2F,
    text-white:                 #FFFFFF,
    primary-bg-colour:          #F3F3F3,
    heading:                    #5C1544,
    border:                     #969696,
    borderSecondary:            #DCDCDC,
    primary:                    #0068AA,
    secondary:                  #D11E4F,
    focusState:                 #F6C037,
    focusBackgroundState:       #FFF7E6,
    hoverState:                 #00B2CF,
    hoverBackgroundState:       #00B2CF,
    activeState:                #00B2CF,
    errorState:                 #D91F26,
    validState:                 #C5DA46,
    panelLightBlue:             rgb(0, 0, 0)
);

@function brand-colour($colour, $colours: $brand-colours) {
    @return map-get($brand-colours, $colour);
}

_body: loaded second

$body-bg-colour:                brand-color('primary-bg-colour') !default;
$body-bg-colour-1:              #FFFFFF !default;
$body-colour:                   brand-colour('text');
$body-font-family:              'ProxinaNova';

_body: loaded last

body {
    background-color: $body-bg-colour-1;
    color: $body-colour;
    font-family: $body-font-family;

    @include hg-mq('med') {
        background-color: $body-bg-colour;
    }
}

in style.scss

@import 'settings/settings';
@import 'base/body';
@import 'shared/body';

I have structured it this way to allow multiple apps to use the same code (last loaded) while only updating the first and second loaded files.

Answer №1

I noticed a small error in your code. The second argument of the brand-colour function is $colours, but you seem to be sticking with the default value instead of utilizing the argument. I have created a demonstration for you to see: DEMO.

Essentially, the brand-colour function is just shorthand for the map-get function with a default value set. It doesn't provide any additional benefit and only adds unnecessary complexity to your code. I would recommend simplifying it by using the map-get function directly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with JavaFX: Unable to remove additional space on the right side of TabPane

While developing a full-screen application on JavaFX 2.2 with tab navigation, I encountered an issue where there is a 10px space at the right side of the headers region. Surprisingly, this space only appears after switching to the last tab and disappears w ...

Is the Piecemaker flash slider being obstructed by its container?

I am currently integrating the Piecemaker flash slider into my new project for the very first time. Unfortunately, I'm facing an issue where the animation is getting cut off by the dimensions of its container. I've been struggling to figure out h ...

Angular 4: Implementing toggle switch functionality in Angular 4 by binding boolean values retrieved from the database

Within my application, I am facing an issue with binding a toggle switch to data stored in the database. The data in the database is represented by a field called Status, which can have values of True or False. My goal is to incorporate toggle switch butto ...

Dynamically loading external JavaScript for an Angular component and triggering the window load event

I am currently dealing with an external javascript file that I only want to be included on a specific component, so the approach I'm taking involves dynamically loading it. I came across this answer that explains exactly how to achieve this. The prob ...

Combining CSS Selectors

Can you combine these selectors into one for ul#footer_navigate: ul#social_footer li a:link, ul#social_footer li a:visited {} I would like the same selector to apply for both anchor states on the ul with ID #footer_navigate. Is there a different approac ...

What is the best way to customize the appearance of the initial row in each tr cluster?

Looking to add a button for expanding child rows within a datatable, with each group in the table having the same child elements.... The provided CSS currently displays the icon on every row throughout the entire table. td.details-control { backg ...

Error message stating: "Form control with the name does not have a value accessor in Angular's reactive forms."

I have a specific input setup in the following way: <form [formGroup]="loginForm""> <ion-input [formControlName]="'email'"></ion-input> In my component, I've defined the form as: this.log ...

Adjusting the starting position of text within an HTML <li> element

I am currently in the process of designing a webpage layout with three columns. I have a specific vision for how I want the text to align within these columns but I am unsure of how to achieve it. Is there a way to make the text start at an exact position, ...

Unable to convert cursor to jpg format

I am facing an issue where I have a jpg file stored in the same folder as my styles.css, and I want to change the cursor on a webpage to this particular jpg file. Despite my efforts, it seems like the cursor is not changing as expected. Currently, I am us ...

Guide to customizing CSS styles within a div element using TypeScript code in a Leaflet legend

I'm struggling to add a legend to my map using Angular 5 and typescript. I need help with setting CSS styles for the values (grades) that are displayed on the legend. Can someone guide me on where to put the styles? TS: createLegend() { let lege ...

Dynamic sizing for sublists

I have come across a nested list structure that looks like this: <ul id="nav"> <li id="" class=""> <a href="http://site.com/wedding.html" class="">Wedding</a> <div class="flyoutWrapper" style="display:block;"> ...

Node server encountering issue with undefined data in POST request

I have been working on an Angular2/Node.js application. Everything seems to be working fine when I retrieve an object from the Node server, but I'm facing an issue when trying to post data to the server. The request.body always shows as undefined. Can ...

What is the best way to ensure items are aligned to the top of the navbar as a picture is enlarged?

I have searched through various similar questions, but none of them have provided a solution to my specific issue. I have attempted multiple suggestions, but none have been successful. (I am working with bootstrap4) Here is the html code I am using: < ...

Tips for customizing the appearance of ng-bootstrap accordion

Looking to enhance the appearance of ng-bootstrap accordion with some unique fade styling. Any suggestions on how to accomplish this? ...

Receiving an error response from the server upon subscribing to an Angular service (2/4/5/6)

I'm currently facing an issue with verifying my OTP. Depending on the response received from the server (whether it's due to OTP mismatch or OTP expiration), I need to display the appropriate error message. However, I am struggling to figure out ...

Floating divs failing to clear properly in Internet Explorer

Encountered a persistent bug that only seems to occur in Internet Explorer. I have set up a jsFiddle to showcase the issue. <div class="container" style="width: 802px;"> <div class="block"></div> <div class="block"></div> ...

Is there a way to create a flexbox that combines a centered fixed child with a fixed child at the bottom?

I'm trying to create a layout using flexbox that looks like this: | | | | | CENTER FIXED ELEMENT | | | | BOTTOM FIXED ELEMENT | Here is the flexbox CSS I've attempted: .wrapper{ ...

Enhancing Security with Subresource Integrity in Angular-Cli

Has anyone discovered a way to enable Subresource Integrity with Angular-CLI? I came across this GitHub Pull Request that suggests it may become a feature in the future: GitHub Pull Request. I tried to activate it on the current versions but had no luck. ...

Create a layout that includes options with checkboxes and divs styled inline

I'm in the process of setting up a voting poll on a website. The poll needs to be presented as a radio button followed by a <div> that contains all relevant poll details. In this <div>, I want the option text to appear on the left and the ...

Troubleshooting Problems with CSS `transform` in JQuery UI's `Slide` Transition

While implementing JQueryUI's slide transition on an element with a CSS transform, I encountered an issue where the top half of the element gets hidden during the animation. Is there a way to tweak either my JQueryUI animation or CSS to avoid this pro ...