font-weight.js 513 B

1234567891011121314151617181920212223
  1. var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
  2. var plugin = {
  3. level1: {
  4. property: function fontWeight(_rule, property, options) {
  5. var value = property.value[0][1];
  6. if (!options.level[OptimizationLevel.One].optimizeFontWeight) {
  7. return;
  8. }
  9. if (value == 'normal') {
  10. value = '400';
  11. } else if (value == 'bold') {
  12. value = '700';
  13. }
  14. property.value[0][1] = value;
  15. }
  16. }
  17. };
  18. module.exports = plugin;