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

Add PreStyle method-like syntax and utility #6

Open
soluml opened this issue Apr 7, 2017 · 0 comments
Open

Add PreStyle method-like syntax and utility #6

soluml opened this issue Apr 7, 2017 · 0 comments
Assignees

Comments

@soluml
Copy link
Owner

soluml commented Apr 7, 2017

Where all template strings are treated as code blocks. Optionally import on PreStyle for a simple method that filters and joins strings.

Example:

import PreStyle from 'pre-style';

const attrs = {
  className: PreStyle(
    `
      font-weight: bold;
      text-align: center;
    `,
    (val === 0 && `color: $color1;`),
    (val === 1 && `color: $color2;`),
    (val === 2 && `color: $color3;`)
  )
};

Would Become:

import PreStyle from 'pre-style';

const attrs = {
  className: PreStyle("A B", "C", "D", "E") //"C", "D" or "E" depending on which is true. Falsey values are stripped by PreStyle method
};
@soluml soluml self-assigned this Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant