You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 542B

1234567891011121314151617181920212223242526
  1. var regStr = "@prefix\\s+([^;]+);";
  2. var globalRegex = new RegExp(regStr, "g");
  3. var localRegex = new RegExp(regStr);
  4. var prefixes = ["-moz-", "-webkit-", "-o-", "-ms-", ""];
  5. module.exports = function(str) {
  6. var matches = str.match(globalRegex);
  7. if (!matches)
  8. return str;
  9. matches.forEach(function(m) {
  10. var cssProperty = m.match(localRegex)[1];
  11. var res = "";
  12. prefixes.forEach(function(prefix) {
  13. res += prefix+cssProperty+"; ";
  14. });
  15. res = res.substring(0, res.length - 1);
  16. str = str.replace(m, res);
  17. });
  18. return str;
  19. }