CSSBeautify.mjs 1001 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @author n1474335 [n1474335@gmail.com]
  3. * @copyright Crown Copyright 2016
  4. * @license Apache-2.0
  5. */
  6. import vkbeautify from "vkbeautify";
  7. import Operation from "../Operation.mjs";
  8. /**
  9. * CSS Beautify operation
  10. */
  11. class CSSBeautify extends Operation {
  12. /**
  13. * CSSBeautify constructor
  14. */
  15. constructor() {
  16. super();
  17. this.name = "CSS Beautify";
  18. this.module = "Code";
  19. this.description = "Indents and prettifies Cascading Style Sheets (CSS) code.";
  20. this.inputType = "string";
  21. this.outputType = "string";
  22. this.args = [
  23. {
  24. "name": "Indent string",
  25. "type": "binaryShortString",
  26. "value": "\\t"
  27. }
  28. ];
  29. }
  30. /**
  31. * @param {string} input
  32. * @param {Object[]} args
  33. * @returns {string}
  34. */
  35. run(input, args) {
  36. const indentStr = args[0];
  37. return vkbeautify.css(input, indentStr);
  38. }
  39. }
  40. export default CSSBeautify;