Skip to content

sass !default behaviour #52

Closed
Closed

Description

@dominictobias

Hi,

I was wondering if there's any intention or interest in adding a !default keyword to this plugin?

It's a powerful feature for theming meaning a component (e.g. one in node_modules) can declare variables with the !default keyword, and then even if the component is included AFTER overrides it will not override them (it uses the first definition of the variable):

$primary-color: blue;
$primary-color: green !default; // Ignored

It means theming can be done with more confidence without worrying that the base theme (default/white-label) won't accidentally override the branding theme.

Activity

  1. ai commented on Jun 7, 2016

    @ai
    Member

    PostCSS try to keep CSS simple and declarative. If you want complicated logic (like prefixes) you should do it in JS.

    This is why I don't like !default - it force you to put logic to CSS and make it hard to read.

    If you have use case, I can show you some other ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions