Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] SCSS 'working smarter' help

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #165524
    markthomes
    Participant

    I have a project where depending on the page the color theme (monochromatic) changes. A class is applied to the body indicating the color scheme.

    I’m working in SCSS and and I can’t help but feel I could be doing this more efficiently, but can’t quite figure out how.

    I created a simple example on codepen.io illustrating my current SCSS workflow.

    http://codepen.io/WithAnEs/pen/AtDbx

    Any advice/help would be greatly appreciated.

    #165550
    mcjohnst
    Participant

    Learn to love mixins and placeholders. They’re what allow you to DRY up your Sass / Scss wherever possible.

    I forked your pen and wrote a super simple mixin at the top. There’s probably better ways of doing it / more optimizations you could make so tinker around.

    Page Color Mixin Pen

    #165605
    markthomes
    Participant

    Thanks. I never knew about using “.#{$class}” in a mixin. That’s helpful. It makes my SCSS considerably more dry that’s for sure. I’m going to have to play with that. Thanks for the feedback and fork.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.