font-weight.js 617 B

12345678910111213141516171819202122
  1. module.exports = function compressFontWeight(node) {
  2. var value = node.children.head.data;
  3. if (value.type === 'Identifier') {
  4. switch (value.name) {
  5. case 'normal':
  6. node.children.head.data = {
  7. type: 'Number',
  8. loc: value.loc,
  9. value: '400'
  10. };
  11. break;
  12. case 'bold':
  13. node.children.head.data = {
  14. type: 'Number',
  15. loc: value.loc,
  16. value: '700'
  17. };
  18. break;
  19. }
  20. }
  21. };