setDeclarationValue.js 385 B

1234567891011121314151617181920
  1. 'use strict';
  2. /** @typedef {import('postcss').Declaration} Declaration */
  3. /**
  4. * @param {Declaration} decl
  5. * @param {string} value
  6. * @returns {Declaration} The declaration that was passed in.
  7. */
  8. module.exports = function setDeclarationValue(decl, value) {
  9. const raws = decl.raws;
  10. if (raws.value) {
  11. raws.value.raw = value;
  12. } else {
  13. decl.value = value;
  14. }
  15. return decl;
  16. };