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

Sass-esq variables for standard css dump #123

Open
garhbod opened this issue Nov 15, 2014 · 2 comments
Open

Sass-esq variables for standard css dump #123

garhbod opened this issue Nov 15, 2014 · 2 comments

Comments

@garhbod
Copy link

garhbod commented Nov 15, 2014

The following code would need altering to suit as I haven't found how your variables/constraints are managed but if you were to set a variable like you would in Sass then have it placed in the CSS dump it would negate the need for any other CSS and only need GSS.

Javascript pulled from gss.js and edited

  StyleSheet.prototype.dumpCSS = function() {
    var css, rule, ruleCSS, _i, _len, _ref;
    css = "";
    _ref = this.rules;
    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
      rule = _ref[_i];
      ruleCSS = rule.dumpCSS();
      if (ruleCSS) {
        css += ruleCSS;
      }
    }
    // for (constraint in constraints) { //loops through the constraints or variables
        _key = 'primary-color'; //constraint.key
        _replace = new RegExp (/\[/.source+_key+/\]/.source, "g");
        _value = '#f0f'; //constraint.value
        css = css.replace(_replace, _value);
    // }
    return css;
  };

Example it would replace in its current state

[primary-color] == '#f0f';

#container {
   color: [primary-color];
}
@paulyoung
Copy link
Contributor

Thanks for the suggestion. I think the implementation would be different in the branches that are currently being developed.

There's been some discussion about if / when / how we should do this.

@makoConstruct
Copy link

I really would appreciate Sass style macros/parametric classes.

On Tue, Nov 25, 2014 at 6:56 AM, Paul Young notifications@github.com
wrote:

Thanks for the suggestion. I think the implementation would be different
in the branches that are currently being developed.

There's been some discussion about if / when / how we should do this.


Reply to this email directly or view it on GitHub
#123 (comment).

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

3 participants