From b9410572eaa2dec0098827006b2cb28789d65487 Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 25 Jun 2016 14:10:10 -0400 Subject: [PATCH] prep for using js-beautify --- .jsbeautifyrc | 11 +++++++++++ .jsbeautifyrc-css | 6 ++++++ .jsbeautifyrc-html | 6 ++++++ utils/beautify.sh | 6 ++++++ 4 files changed, 29 insertions(+) create mode 100644 .jsbeautifyrc create mode 100644 .jsbeautifyrc-css create mode 100644 .jsbeautifyrc-html create mode 100755 utils/beautify.sh diff --git a/.jsbeautifyrc b/.jsbeautifyrc new file mode 100644 index 0000000..6e74042 --- /dev/null +++ b/.jsbeautifyrc @@ -0,0 +1,11 @@ +{ + "allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"], + "end_with_newline": true, + "indent_size": 2, + "indent_char": " ", + "indent_level": 0, + "indent_with_tabs": false, + "preserve_newlines": true, + "max_preserve_newlines": 2, + "jslint_happy": true +} diff --git a/.jsbeautifyrc-css b/.jsbeautifyrc-css new file mode 100644 index 0000000..dce2525 --- /dev/null +++ b/.jsbeautifyrc-css @@ -0,0 +1,6 @@ +{ + "allowed_file_extensions": ["css", "scss", "sass", "less"], + "indent_size": 2, + "selector_separator_newline": true, + "newline_between_rules": true +} diff --git a/.jsbeautifyrc-html b/.jsbeautifyrc-html new file mode 100644 index 0000000..20e5dfd --- /dev/null +++ b/.jsbeautifyrc-html @@ -0,0 +1,6 @@ +{ + "allowed_file_extensions": ["htm", "html"], + "indent_size": 4, + "preserve_newlines": true, + "max_preserve_newlines": 1 +} diff --git a/utils/beautify.sh b/utils/beautify.sh new file mode 100755 index 0000000..d47e444 --- /dev/null +++ b/utils/beautify.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +find src -type f -not -path "*tests*" -name '*.js' | xargs -n1 js-beautify --config .jsbeautifyrc -r +find src -type f -not -path "*tests*" -name '*.css' | xargs -n1 css-beautify --config .jsbeautifyrc-css -r +find src -type f -not -path "*tests*" -name '*.scss' | xargs -n1 css-beautify --config .jsbeautifyrc-css -r +find src -type f -not -path "*tests*" -name '*.html' | xargs -n1 html-beautify --config .jsbeautifyrc-html -r +html-beautify --config .jsbeautifyrc-html -r example.html