DEV: Configure prettier for hbs templates

This commit is contained in:
David Taylor 2022-12-28 12:25:42 +00:00
parent 61b2d2eade
commit 104a16610a
8 changed files with 13 additions and 2 deletions

View File

@ -26,7 +26,6 @@ dist/
tmp/
**/*.rb
**/*.hbs
**/*.html
**/*.json
**/*.md

View File

@ -21,5 +21,11 @@ module.exports = {
"no-implicit-this": {
allow: ["loading-spinner"],
},
// Begin prettier compatibility
"eol-last": false,
"self-closing-void-elements": false,
"block-indentation": false,
quotes: false,
// End prettier compatibility
},
};

View File

@ -0,0 +1,2 @@
{{! prettier-ignore }}
<svg class="fa d-icon d-icon-custom-google-oauth2 svg-icon" viewBox="0 0 48 48"><defs><path id="a" d="M44.5 20H24v8.5h11.8C34.7 33.9 30.1 37 24 37c-7.2 0-13-5.8-13-13s5.8-13 13-13c3.1 0 5.9 1.1 8.1 2.9l6.4-6.4C34.6 4.1 29.6 2 24 2 11.8 2 2 11.8 2 24s9.8 22 22 22c11 0 21-8 21-22 0-1.3-.2-2.7-.5-4z"/></defs><clipPath id="b"><use href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FBBC05" d="M0 37V11l17 13z"/><path clip-path="url(#b)" fill="#EA4335" d="M0 11l17 13 7-6.1L48 14V0H0z"/><path clip-path="url(#b)" fill="#34A853" d="M0 37l30-23 7.9 1L48 0v48H0z"/><path clip-path="url(#b)" fill="#4285F4" d="M48 48L17 24l-4-3 35-10z"/></svg>

View File

@ -1,7 +1,7 @@
{{#each this.buttons as |b|}}
<button type="button" class="btn btn-social {{b.name}}" {{on "click" (action this.externalLogin b)}} aria-label={{b.screenReaderTitle}} tabindex="3">
{{#if b.isGoogle}}
<svg class="fa d-icon d-icon-custom-google-oauth2 svg-icon" viewBox="0 0 48 48"><defs><path id="a" d="M44.5 20H24v8.5h11.8C34.7 33.9 30.1 37 24 37c-7.2 0-13-5.8-13-13s5.8-13 13-13c3.1 0 5.9 1.1 8.1 2.9l6.4-6.4C34.6 4.1 29.6 2 24 2 11.8 2 2 11.8 2 24s9.8 22 22 22c11 0 21-8 21-22 0-1.3-.2-2.7-.5-4z"/></defs><clipPath id="b"><use href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FBBC05" d="M0 37V11l17 13z"/><path clip-path="url(#b)" fill="#EA4335" d="M0 11l17 13 7-6.1L48 14V0H0z"/><path clip-path="url(#b)" fill="#34A853" d="M0 37l30-23 7.9 1L48 0v48H0z"/><path clip-path="url(#b)" fill="#4285F4" d="M48 48L17 24l-4-3 35-10z"/></svg>
<GoogleIcon />
{{else if b.icon}}
{{d-icon b.icon}}
{{else}}

View File

@ -1,3 +1,4 @@
{{! prettier-ignore }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 385 104">
<g id="discourse-logo-large" fill="none" fill-rule="nonzero">
<path class="logo-contour" fill="var(--primary)"

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -1,3 +1,4 @@
{{! prettier-ignore }}
<svg xmlns="http://www.w3.org/2000/svg" id="wizard-members-illustration" viewBox="0 0 891.79 761.94">
<defs>
<pattern id="Unnamed_Pattern_2" x="0" y="0" width="144" height="144" patternTransform="matrix(1.3 0 0 -.96 405.71 -15766.98)" patternUnits="userSpaceOnUse">

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,3 +1,4 @@
{{! prettier-ignore }}
<svg xmlns="http://www.w3.org/2000/svg" id="wizard-welcome-illustration" viewBox="0 0 941.69 730.8">
<defs>
{{! template-lint-disable no-forbidden-elements }}

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -58,6 +58,7 @@ def write_hbs_template(path, task_name, template)
basename = File.basename(path)
output_path = "#{Rails.root}/app/assets/javascripts/#{path}"
File.write(output_path, "#{header}\n#{template}")
%x{yarn run prettier --write #{output_path}}
puts "#{basename} created"
end