This commit is contained in:
asep komarudin 2023-01-15 00:19:37 +07:00
parent e53a643e3d
commit 1ab37bd478
209 changed files with 79957 additions and 0 deletions

View file

@ -0,0 +1,34 @@
export class BladeFormatter
{
newLine: string = "\n";
indentPattern: string;
constructor(options?: IBladeFormatterOptions) {
options = options || {};
// options default value
options.tabSize = options.tabSize || 4;
if (typeof options.insertSpaces === "undefined") {
options.insertSpaces = true;
}
this.indentPattern = (options.insertSpaces) ? " ".repeat(options.tabSize) : "\t";
}
format(inuptText: string): string {
let inComment: boolean = false;
let output: string = inuptText;
// fix #57 url extra space after formatting
output = output.replace(/url\(\"(\s*)/g, "url\(\"");
return output.trim();
}
}
export interface IBladeFormatterOptions
{
insertSpaces?: boolean;
tabSize?: number;
}