Created
December 18, 2017 13:37
-
-
Save brnpimentel/3660b71dbc68691cdc8ac41cec379e2f to your computer and use it in GitHub Desktop.
JS Beautify hack to works with blade directives (laravel)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function style_html(html_source, options, js_beautify, css_beautify) { | |
html_source = html_source.replace(/\@([^\n\s]*)/ig, "<blade $1/>"); | |
... | |
sweet_code = sweet_code.replace(/<blade ([^\n]*)\/>/ig, "@$1"); | |
sweet_code = sweet_code.replace(/\(\ \'/ig, "('"); | |
... | |
return sweet_code; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made some improvement from codes above, this is not perfect but makes blade formatter cleaner
hope this will help
happy coding!