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

When using aliases, every other color transform fails (=> #000000) #35

Closed
javoire opened this issue Feb 24, 2015 · 8 comments
Closed

When using aliases, every other color transform fails (=> #000000) #35

javoire opened this issue Feb 24, 2015 · 8 comments

Comments

@javoire
Copy link
Contributor

javoire commented Feb 24, 2015

Using theo 3.0.3 and:

// main.js

#!/usr/bin/env node

var gulp = require('gulp');
var theo = require('theo');

// web
gulp.src('variables/brand-colors.json')
  .pipe(theo.plugins.transform('web'))
  .pipe(theo.plugins.format('less'))
  .pipe(gulp.dest('dist'));

// ios
gulp.src('variables/brand-colors.json')
  .pipe(theo.plugins.transform('ios'))
  .pipe(theo.plugins.format('ios.json'))
  .pipe(gulp.dest('dist'));

// android
gulp.src('variables/brand-colors.json')
  .pipe(theo.plugins.transform('android'))
  .pipe(theo.plugins.format('android.xml'))
  .pipe(gulp.dest('dist'));
// brand-colors.json

{
  "aliases": {
    "GRAY_HUE": 226,
    "SAT_20_AND_BELOW": "10%",
    "SAT_OVER_20": "3%"
  },
  "props": {
    "GRAY_8": {
      "value": "hsv({!GRAY_HUE}, {!SAT_20_AND_BELOW}, 8%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_12": {
      "value": "hsv({!GRAY_HUE}, {!SAT_20_AND_BELOW}, 12%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_15": {
      "value": "hsv({!GRAY_HUE}, {!SAT_20_AND_BELOW}, 15%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_20": {
      "value": "hsv({!GRAY_HUE}, {!SAT_20_AND_BELOW}, 20%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_25": {
      "value": "hsv({!GRAY_HUE}, {!SAT_OVER_20}, 25%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_55": {
      "value": "hsv({!GRAY_HUE}, {!SAT_OVER_20}, 55%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_70": {
      "value": "hsv({!GRAY_HUE}, {!SAT_OVER_20}, 70%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_80": {
      "value": "hsv({!GRAY_HUE}, {!SAT_OVER_20}, 80%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_90": {
      "value": "hsv({!GRAY_HUE}, {!SAT_OVER_20}, 90%)",
      "type": "color",
      "category": "color"
    },
    "GRAY_95": {
      "value": "hsv({!GRAY_HUE}, {!SAT_OVER_20}, 95%)",
      "type": "color",
      "category": "color"
    }
  }
}
// brand-colors.less
@gray-8: rgb(18, 19, 20);
@gray-12: rgb(0, 0, 0);
@gray-15: rgb(34, 35, 38);
@gray-20: rgb(0, 0, 0);
@gray-25: rgb(62, 62, 64);
@gray-55: rgb(0, 0, 0);
@gray-70: rgb(173, 174, 179);
@gray-80: rgb(0, 0, 0);
@gray-90: rgb(223, 224, 230);
@gray-95: rgb(0, 0, 0);

brand-colors.ios.json and brand-colors.android.xml also get every other color as black

@javoire
Copy link
Contributor Author

javoire commented Feb 24, 2015

With only one alias per value, same result. With no aliases at all (hardcoded values), correct result

@aputinski
Copy link
Contributor

@javoire I'm having trouble reproducing this one. I ran the above file through the tests and get this as the less output:

@gray-8: rgb(18, 19, 20);
@gray-12: rgb(28, 28, 31);
@gray-15: rgb(34, 35, 38);
@gray-20: rgb(46, 47, 51);
@gray-25: rgb(62, 62, 64);
@gray-55: rgb(136, 137, 140);
@gray-70: rgb(173, 174, 179);
@gray-80: rgb(198, 199, 204);
@gray-90: rgb(223, 224, 230);
@gray-95: rgb(235, 237, 242);

@javoire
Copy link
Contributor Author

javoire commented Feb 24, 2015

Interesting. Guess I'll have to see if I can nail down its reproducibility a bit more. I'll be back!

@javoire
Copy link
Contributor Author

javoire commented Feb 26, 2015

Sooo, i zipped my exact setup, so try this one ^^ https://drive.google.com/file/d/0B3xlHBm9Aj2aUDJBUGt6TDE0RG8/view?usp=sharing

@aputinski
Copy link
Contributor

@javoire I finally tracked down the issue — seems that there is a RegExp bug in node 0.10.36, and I was running 0.12.0. I just published Theo 3.0.6 which should fix the issue.

@javoire
Copy link
Contributor Author

javoire commented Feb 26, 2015

awesome!

@aputinski
Copy link
Contributor

@javoire Can you test and close this issue when you have a chance? Thanks!

@javoire
Copy link
Contributor Author

javoire commented Feb 26, 2015

works like a charm!

@javoire javoire closed this as completed Feb 26, 2015
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

2 participants