icon.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. exports.init = function(runtime) {
  2. runtime.register({
  3. // This function parses arguments from all formats accepted by the icon()
  4. // sass mixin and returns an array that always contains 3 elements in the following
  5. // order: character, font-family, rotation
  6. parseIconArgs: function(glyph) {
  7. var newItems = [null, null, null],
  8. items, item, len;
  9. if (glyph.$isFashionList) {
  10. items = glyph.items;
  11. len = items.length;
  12. newItems[0] = items[0];
  13. if (len === 2) {
  14. item = items[1];
  15. if (item.$isFashionNumber) {
  16. newItems[2] = item;
  17. } else {
  18. newItems[1] = item;
  19. }
  20. } else if (len > 2) {
  21. newItems[1] = items[1];
  22. newItems[2] = items[2];
  23. }
  24. } else {
  25. newItems[0] = glyph;
  26. }
  27. return new Fashion.List(newItems);
  28. }
  29. });
  30. };