Sass issue: extending selector groups is not permitted

Every time I try to compile my SCSS file into CSS, I encounter an error. The specific error message states: "selector groups may not be extended" pertaining to the line @extend .btn, .btn-link;.

Just a heads up: I have Bootstrap imported in my primary scss file.

Snippet of the code:

button {
    @extend .btn, .btn-link;
    background-color: $lf-green;
    color: #fff;
    font-size: 10px;
    padding: 2px 5px;
    text-transform: uppercase;

    &:hover {
        background: rgba(5,97,43,0.9);
        color: #fff;
        text-decoration: none;
    }
}

What am I missing here?

Many thanks!

UPDATE:

Just for future reference: The reason this was not possible is because I was using lib-sass via node-sass, which doesn't align with the current sass version available conventionally https://github.com/andrew/node-sass#reporting-sass-compilation-and-syntax-issues.

Answer №1

It appears that you are unable to extend multiple selectors in this manner.

You may want to consider trying the following approach:

@extend .btn;
@extend .btn-link;

Although it may seem a bit redundant, I have personally found success with this method in my own projects.

UPDATE: As I was reviewing the SASS_REFERENCE, I came across information stating that:

Multiple extends can also be written using a comma-separated list of selectors. For instance, @extend .error, .attention is equivalent to @extend .error; @extend.attention.

I discovered from the changelog that this particular format was initially introduced in version 3.1.15, suggesting that your Sass version might be outdated.

I highly recommend upgrading to the most recent version for access to additional functionalities, ensuring your code remains intact through updates—though resolving any inconsistencies should be relatively straightforward.

Answer №2

You are not allowed to expand multiple selectors simultaneously.

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

Unpredictable hue of text

Is it possible to fill text with a combination of 2-3 random colors? ...

Tips on presenting messages to users after clicking the submit button?

I am trying to extract data from a table. I am unsure if my current code is able to retrieve the value from the table. <script> function validateForm() { var x = document.forms["assessmentForm"]["perf_rating11"].value; var y = document.f ...

Adjust the vertical alignment of the Bootstrap Navbar Container

Seeking a solution to modify the default positioning of a container within the Bootstrap navbar. By default, it is vertically centered in the navbar wrapper (refer to the image below), but I would like it to be aligned to the top. https://i.sstatic.net/XU ...

Display each div one at a time

I am working on a script that should reveal my divs step by step. However, the current code only shows all the divs at once when clicked. How can I modify it to detect each individual div and unveil them one by one? For example, on the 1st click => expa ...

Adding Font Awesome to my Angular 12 project within Visual Studio 2019

Seeking a no-frills guide for integrating Font Awesome (free version) into my Angular 12 application within Visual Studio 2019. After countless Google searches, I am bombarded with intricate methods. It's baffling why such complexity exists just to in ...

From one corner to the opposite, creating diagonal dividers

I want to create a web page similar to the one below. Although I specialize in back-end programming, I am eager to expand my knowledge of design in order to build visually appealing sites. My goal is to include 7 diagonal divs (each representing a color of ...

Is there an animation triggered by hovering the mouse over?

I've implemented a bounce animation that is triggered by mouseover on an image. Currently, the animation only happens once, but I want it to bounce every time the mouse hovers over it. Here is the HTML code: <div class="hair"> <img src= ...

Sass can be used to create custom color classes for Bootstrap 5.3 that offer

I am currently using a Bootstrap 5.3 theme and I would like to give users the option to change the main color theme from the default blue to something like purple or orange. My idea is to create additional CSS files named "orange-as-primary.css", "purple- ...

A table featuring an HTML select element that allows users to choose from preset options or manually enter

My goal is to incorporate a select box where users can either choose from a set list of options or input their own custom value. The select element is nested within a table. Unfortunately, using datalist is not a viable solution for me in this case. I have ...

The animated 3D cube is specifically compatible with Firefox

After working on a 3D animated cube that rotates infinitely in two angles, I encountered some browser compatibility issues. The cube can be found on the home page of our new company website (next to the Software title when scrolling down) at test website. ...

How to prevent text from wrapping around images in WordPress

Hmm, I'm facing an issue at the moment: https://i.sstatic.net/MCesD.jpg I really need to ensure that the text never goes beneath the image. Since my website runs on Wordpress and every post is unique, I'm looking for a solution that can ...

Is there a way to incorporate two different colors for font in a single JQuery string?

As a coding novice, I am curious to learn if it is feasible to use two different colors within a single jQuery string. For instance, if I aim to have the word 'Message' displayed in black (its current color) and 'Example' in a light gre ...

The stretched-link is dysfunctional when combined with its parent CSS transform: translate

When using Bootstrap 5, there seems to be an issue with the .stretched-link class not working properly on elements that have a CSS transform translate applied to them. How can this problem be addressed? .btn { transform: translate(0,0); } <link hre ...

Interactive jQuery Dropdown Menu with Multiple Divs

I have been working on this and I'm almost there, but the jQuery part is driving me crazy (I'm not very proficient in it yet, but I am learning). Here's the link to the fiddle: http://jsfiddle.net/5CRA5/4/ Since I can't demonstrate th ...

Embedding text within an image and adjusting its size simultaneously

My goal is to include a paragraph within an image, but the text keeps overflowing beyond the boundaries. I would like the image to resize proportionally to accommodate the length of the paragraph. Despite attempting to use the min-height property, I have ...

Footer remains attached to the bottom of the page while the content extends too far down

Having some trouble with my sticky footer - despite checking out various resources and examples, I can't seem to achieve the desired outcome. Update: I don't want the footer to be fixed. I want it to stay at the bottom of the screen if there isn ...

Is there a way to horizontally navigate a pallet using Next and Prev buttons?

As someone new to development, I am looking for a way to scroll my question pallet up and down based on the question number when I click next and previous buttons. In my pallet div, there are over 200 questions which are dynamically generated. However, th ...

Setting up a ClientBundle in GWT with multiple CssResources

I am currently in the process of updating some older code to GWT 2 and encountering some strange behavior. I have a custom interface that extends ClientBundle, as recommended by the GWT documentation. Within this bundle, I have defined multiple CssResource ...

Ways to design a vertical tab using CSS and JavaScript

I am currently working on creating a Vertical tab element using CSS and jQuery. However, I am facing an issue where I need to display the content of the first tab upon page load. I have tried using the following line of code but it does not seem to be work ...

When printing a table in HTML/CSS, only the header will appear on the empty page

I'm struggling to figure out why there are two pages, one blank and one with just the table header in this document. The content looks fine otherwise, but I can't seem to remove these extra pages. Here is the full HTML code: <!DOCTYPE html& ...