GithubHelp home page GithubHelp logo

shospodarets / css-vars Goto Github PK

View Code? Open in Web Editor NEW
181.0 5.0 8.0 601 KB

Sass mixin to use CSS Custom Properties with Sass

Home Page: https://www.npmjs.com/package/css-vars

License: MIT License

JavaScript 46.06% HTML 18.62% SCSS 35.32%
css sass scss sass-mixins css-variables css-custom-properties

css-vars's People

Contributors

shospodarets avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

css-vars's Issues

Documentation for .sass implementations

Been dealing with SASS and it's lack of support for :root and came across this awesome library; So far I'm really digging it, but ran into a few other intrinsic limitations with the .sass syntax...

Namely: sass/sass#1088

Through that thread I found a user comment (sass/sass#1088 (comment)) which mentioned the map-merge method which solves this issue nicely.

@import "[%PATH%]/css-vars/css-vars";

$rootvars: ()

$rootvars: map-merge($rootvars, ( '--sidebar-width': $sidebar-width ))
$rootvars: map-merge($rootvars, ( '--topnav-height': $topnav-height ))
$rootvars: map-merge($rootvars, ( '-moz-tab-size': 4 ))
$rootvars: map-merge($rootvars, ( 'tab-size': 4 ))

@include css-vars($rootvars)

This yields the cleanest way to manage the syntax for .sass files and thought this might help other people in a similar situation.

Use native vars with non-native fallback

Hi, thanks for this lib.

I was wondering if there is a way to use native vars with fallback to non-native attribute.

So let's say this

@include css-vars((
        --main-color: #000,
));

body {
       color: var(--main-color);
}

Will compile to this

body {
color: #000,
color: var(--main-color);
}

And if the browser will support css properties it will use the second value from variable, but if not it will fall-back to first condition.

Thanks

Declaring variables inside selectors and redefine variable inside nested media query doesn't work

Hi, I just read the post on Smashing Magazine and want to give this a try. Here's the issue I met.

  .cell__subtitle {
    @include css-vars(( --margin-left: r(1) ));
    display    : inline-block;
    margin-left: var(--margin-left);
    font-size  : 12px;
    @include susy($tablet) {
      display: block;
      @include css-vars(( --margin-left: 0 ));
    }
  }

The margin-left: 0 didn't show in browser inspector, but when using this in native way, it worked.

Assign Sassy Var with CSS property

Should I be able to do something like this?

@include css-var ((
    --primary: black;
     ....
));

$primary:  var(--primary);

because right now it looks like I can't do things like.

background-color: fade-out(var(--primary), 0.2);

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.