Skip to content

Instantly share code, notes, and snippets.

@valeryan
valeryan / beautify-html.js
Last active Dec 11, 2018 — forked from mpryvkin/beautify-html.js
JS Beautify hack to work with Blade directives (Laravel)
View beautify-html.js
function Beautifier(html_source, options, js_beautify, css_beautify) {
//Wrapper function to invoke all the necessary constructors and deal with the output.
html_source = html_source || '';
// BEGIN (around line 199)
console.log(html_source);
html_source = html_source.replace(/\{\{((?:(?!\}\}).)+)\}\}/g, function (m, c) {
if (c) {
c = c.replace(/(^[ \t]*|[ \t]*$)/g, '');
c = c.replace(/'/g, ''');