2018-05-27 23:07:09 +02:00
|
|
|
/**
|
|
|
|
* @author n1474335 [n1474335@gmail.com]
|
|
|
|
* @copyright Crown Copyright 2016
|
|
|
|
* @license Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
import vkbeautify from "vkbeautify";
|
2019-07-09 13:23:59 +02:00
|
|
|
import Operation from "../Operation.mjs";
|
2018-05-27 23:07:09 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CSS Beautify operation
|
|
|
|
*/
|
|
|
|
class CSSBeautify extends Operation {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CSSBeautify constructor
|
|
|
|
*/
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
|
|
|
|
this.name = "CSS Beautify";
|
|
|
|
this.module = "Code";
|
|
|
|
this.description = "Indents and prettifies Cascading Style Sheets (CSS) code.";
|
|
|
|
this.inputType = "string";
|
|
|
|
this.outputType = "string";
|
|
|
|
this.args = [
|
|
|
|
{
|
|
|
|
"name": "Indent string",
|
|
|
|
"type": "binaryShortString",
|
|
|
|
"value": "\\t"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} input
|
|
|
|
* @param {Object[]} args
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
run(input, args) {
|
|
|
|
const indentStr = args[0];
|
|
|
|
return vkbeautify.css(input, indentStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export default CSSBeautify;
|