Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@value's with newlines are not recognised by this plugin #109

Open
AKST opened this issue Nov 12, 2017 · 0 comments
Open

@value's with newlines are not recognised by this plugin #109

AKST opened this issue Nov 12, 2017 · 0 comments

Comments

@AKST
Copy link

AKST commented Nov 12, 2017

I'm going to recap the discussion on the module ember-css-modules repo, but basically I've run into an issue where values when newlines aren't recognised by this plugin, so I ended up writing a preprocessor that stripped newlines from values. Which wasn't that hard as the postcss plugin API exposes the text for an at rule as string.

Anyways is this by design or this a bug?


Examples

I would expect that when you write this

@value fontSize: media-value(
  case: "a" as: "18px",
  case: "b" as: "16px",
  case: "c" as: "16px",
  case: "d" as: "14px",
  else: "14px",
);

.fontDef {
  font-size: fontSize;
}

I would have expected this plugin to move the value of fontSize into the rule fontDef and you would have output like this:

.fontDef {
  font-size: media-value(
    case: "a" as: "18px",
    case: "b" as: "16px",
    case: "c" as: "16px",
    case: "d" as: "14px",
    else: "14px",
  );
}

An aside

The example above is from my postcss plugin which expands the media-value into media queries for each case. But just incase I missed something and before I pour to much time into that plugin, I actually made it to be used in conjunction with this plugin & css modules. Are there plans to facilitate responsive values in this plugin, or is there functionality already in this plugin that enables this?

From what I understand there isn't which probably has something to do with messing up the javascript API, which is what my plugin does anyways.

@AKST AKST changed the title Values with newlines unrecognised why this plugin @value's with newlines are not recognised, by this plugin Nov 12, 2017
@AKST AKST changed the title @value's with newlines are not recognised, by this plugin @value's with newlines are not recognised by this plugin Nov 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant