-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render tag <%=%> replaced with [object Object] when used in img tag #50
Comments
Current config: |
Also seeing this, appears to be when the ERB tag is within double quotes:
|
I have located the problem, will fix it tomorrow hopefully. Thanks guys for reporting. |
any update on this? or a workaround? |
sorry for the wait, @karthikkasturi I've just released a fix, please check the version 0.3.0 |
I'm seeing the issue with With the following versions {
"@prettier/plugin-ruby": "1.5.5",
"prettier": "2.2.1",
"prettier-plugin-erb": "0.3.0"
} Running prettier on this <script>
var custom = '<%= data.to_json %>';
</script> would result in the following <script>
var custom = '[object Object]';
</script> |
@marcuslilja I'll try to resolve this one over the weekend, sorry for trouble |
Thanks 👍 |
Same issue also happens with Input: Output: |
Hey, chiming in to report the same issue, in another context: Versions: "@prettier/plugin-ruby": "^1.5.5",
"prettier": "^2.3.1",
"prettier-plugin-erb": "^0.3.0", Source: <div
class="form-group mb-3"
data-controller="avatar-field"
data-avatar-field-fallback-image-value="<%= image_path "icons/user-astronaut-regular.svg" %>"
> Formatted output: <div
class="form-group mb-3"
data-controller="avatar-field"
data-avatar-field-fallback-image-value="[object Object]"
> |
Released a fix, please check 0.4.0. |
Thank you @adamzapasnik... but this seems worse :/ package.json: "devDependencies": {
- "@prettier/plugin-ruby": "^1.5.5",
+ "@prettier/plugin-ruby": "^1.6.0",
"prettier": "^2.3.1",
- "prettier-plugin-erb": "^0.3.0",
+ "prettier-plugin-erb": "^0.4.0",
"webpack-dev-server": "^3.11.2"
}, Input: <div class="form-group mb-3">
<%= form.label :name, "Full name" %>
<%= form.text_field :name, value: params[:name] || customer.name, class: "form-control", placeholder: "First name + last name" %>
</div>
<div
class="form-group mb-3"
data-controller="avatar-field"
data-avatar-field-fallback-image-value="<%= image_path "icons/user-astronaut-regular.svg" %>"
> Output: <div class="form-group mb-3">
<eext7 />
<eext8 />
</div>
<div
class="form-group mb-3"
data-controller="avatar-field"
data-avatar-field-fallback-image-value="eex9eex"
> |
Downgrading "devDependencies": {
- "@prettier/plugin-ruby": "^1.5.5",
- "prettier": "^2.3.1",
- "prettier-plugin-erb": "^0.3.0",
+ "@prettier/plugin-ruby": "^1.6.0",
+ "prettier": "2.2.1",
+ "prettier-plugin-erb": "^0.4.0",
}, Actually I also tried without upgrading "devDependencies": {
"@prettier/plugin-ruby": "^1.5.5",
- "prettier": "^2.3.1",
+ "prettier": "2.2.1",
"prettier-plugin-erb": "^0.3.0",
}, |
I am still having this problem even with the above package versions. It seems to only apply for ERB tags nested inside of specific other tags. EDIT: Maybe it's broken for specific tag types? If I have an ERB tag inside of a |
This issue is still present for all tag types present in this array. https://github.com/adamzapasnik/prettier-html-templates/blob/master/lib/tokenizer.js#L39 |
Still an issue inside <title> tags for these deps {
"devDependencies": {
"@prettier/plugin-ruby": "1.5.5",
"prettier": "2.2.0",
"prettier-plugin-erb": "0.2.0"
}
} Also for 0.3.0. But it seems to work with 0.4.0. |
Eg:
in my erb file, formatting
<img src="<%= logo %>" />
gives output
<img src="[object Object]"/>
The text was updated successfully, but these errors were encountered: