isStandardSyntaxProperty.js 694 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const hasInterpolation = require('../utils/hasInterpolation');
  3. const isScssVariable = require('./isScssVariable');
  4. /**
  5. * Check whether a property is standard
  6. *
  7. * @param {string} property
  8. * @returns {boolean}
  9. */
  10. module.exports = function isStandardSyntaxProperty(property) {
  11. // SCSS var
  12. if (isScssVariable(property)) {
  13. return false;
  14. }
  15. // Less var (e.g. @var: x)
  16. if (property.startsWith('@')) {
  17. return false;
  18. }
  19. // Less append property value with space (e.g. transform+_: scale(2))
  20. if (property.endsWith('+') || property.endsWith('+_')) {
  21. return false;
  22. }
  23. // SCSS or Less interpolation
  24. if (hasInterpolation(property)) {
  25. return false;
  26. }
  27. return true;
  28. };