Git Product home page Git Product logo

Comments (7)

Andy-Corrigan avatar Andy-Corrigan commented on June 30, 2024

Update:

This block is the closest I've gotten:

@function Quotify($variable) {
    @return #{"\""#{$variable}"\""};
}

@mixin theme() {
    @each $theme, $map in $themes {
        @if $theme == "default" {
            :root {
                @each $key, $value in $map {
                    #{--#{$key}}: $value;
                }
            }
        }
        @else {
            $Quoted: Quotify($theme);

            [data-theme=#{$Quoted}] {
                @each $key, $value in $map {
                    #{--#{$key}}: $value;
                }
            }
        }
    }
}

@include theme();

Which gets: [data-theme=" dark "]

from webcompiler.

failwyn avatar failwyn commented on June 30, 2024

Can you give this a try and let me know if it works as expected?

https://sass-lang.com/documentation/values/strings

from webcompiler.

Andy-Corrigan avatar Andy-Corrigan commented on June 30, 2024

That was the first place I'd looked - using the quote function instead of that custom one resulted in data-theme=""dark""

Initially, I'd thought it was just my mistake, so I had made this question on SO

from webcompiler.

failwyn avatar failwyn commented on June 30, 2024

Are the quotes here required? This could be related to this issue.

sass/sass#2845

from webcompiler.

Andy-Corrigan avatar Andy-Corrigan commented on June 30, 2024

Ahh, looking into it based on that feedback; it looks like it's optional (so long as the value is alphanumeric). So, it's probably worth looking into, just incase someone needs it for a href tag at some point.

from webcompiler.

failwyn avatar failwyn commented on June 30, 2024

The string.quote($variable) syntax appears to work as expected outside of the attribute selector, if you have an example where the quotes are required, but you can't get them to stay, I'd be happy to file a bug with Dart Sass and upgrade the extension when they address it.

from webcompiler.

failwyn avatar failwyn commented on June 30, 2024

I'm gonna close this issue since I haven't found any places where it removed the quotes when they are required.

from webcompiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.