Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8727839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:30:53+00:00 2026-06-13T08:30:53+00:00

Is it possible to apply variables to the local scope from a mixin or

  • 0

Is it possible to apply variables to the local scope from a mixin or function? For example:

.hello-world
    get-variables(bar);
    content: $foo;

Will output to:

.hello-world
    content: 'bar';

Because the get-variables mixin applied a variable named $foo to the local scope.

Is this possible in Stylus? If not, is it possible with Sass?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:30:54+00:00Added an answer on June 13, 2026 at 8:30 am

    At the time of writing I don’t think it’s possible to return variables from a mixin or function in Stylus.

    For example:

    val = green
    
    foo()
        val = red
        return val
    
    .foo
        foo()
        color val
    

    Returns:

    .foo {
        color: green;
    }
    

    In SASS however this:

    $val: green
    
    @mixin foo 
        $val: red
    
    .foo
        @include foo
        color: $val
    

    Will return:

    .foo {
        color: red;
    }
    

    In Stylus however you can assign the result of a function to a variable which may or may not give you the result you are looking for.

    val = foo()
    content val
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

JavaScript has lexical scoping which means that non-local variables accessed from within a function
In JavaScript, is it possible to return a value from a parent function from
Is it possible to define a function in the scope of a parent function
Is it possible to apply a workflow in Sitecore only for a particular user?
Is it possible to apply a heading style (especially heading 3 as in excel
Is it possible to apply formatting to a specific row in Slickgrid? I am
Is it possible to apply a css(3) style to a label of a checked
Is it possible to apply (and remove) Windows group policy settings using .NET? I
Is it possible to apply reactive framework (Rx) in MVC application? or is it
Is it possible to apply trigger on any table in information_schema?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.