Skip to content

Instantly share code, notes, and snippets.

View valeryan's full-sized avatar

Samuel Hilson valeryan

View GitHub Profile
@valeryan
valeryan / beautify-html.js
Last active December 11, 2018 09:47 — forked from mpryvkin/beautify-html.js
JS Beautify hack to work with Blade directives (Laravel)
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, ''');