Skip to content
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

ERB Support? #86

Closed
lallmon opened this issue Sep 11, 2014 · 10 comments · May be fixed by cooljl31/atom-beautify#16
Closed

ERB Support? #86

lallmon opened this issue Sep 11, 2014 · 10 comments · May be fixed by cooljl31/atom-beautify#16
Assignees

Comments

@lallmon
Copy link

lallmon commented Sep 11, 2014

Erb is pretty much HTML, however it seems as though atom-beautify doesn't do anything. You can quickly rename the file, but that gets tedious.

Any way to enable it or what would it take to get support?

@Glavin001 Glavin001 self-assigned this Sep 11, 2014
@Glavin001
Copy link
Owner

Duplicate of #80

@Lucaska, you should be able to beautify ERB as of v0.8.0
It uses https://github.com/threedaymonk/htmlbeautifier, so gem install htmlbeautifier first, and you should be all set 👍.

Let me know if you have any further problems.

@lallmon
Copy link
Author

lallmon commented Sep 11, 2014

I get a popup with this

Command failed: /bin/sh -c [ -f ~/.bash_profile ] && source ~/.bash_profile;[ -f ~/.bashrc ] && source ~/.bashrc;htmlbeautifier < "/var/folders/hh/fgv_7zjs1m5gbv7v9k6vhg8m0000gn/T/input114811-26038-48c2p5" > "/var/folders/hh/fgv_7zjs1m5gbv7v9k6vhg8m0000gn/T/114811-26038-17msfp3" /bin/sh: htmlbeautifier: command not found

I don't know exactly what that is saying, but I don't use bash, I use zsh. I checked in the options to see if that was a setting and didn't see anything.

HTMLbeautifier seems to run fine if I run it through zsh on a file (even if it doesn't fail gracefully)

@Glavin001
Copy link
Owner

@Lucaska , could you provide me with some more diagnostic information:

  • Your Operating system
  • Atom Beautify version
  • Do you have a ~/.bash_profile or ~/.bashrc file? Normally these could modify your PATH environment variable such that your shell knows how to access htmlbeautifer, however Node.js has problems with the PATH environment variable and the beginning of the above bash script is to help mitigate such problems. It may not be working in your case.
  • What is the path of your htmlbeautifer installation? Running which htmlbeautifer is how I would do it. For instance,
$ which htmlbeautifier
/usr/bin/htmlbeautifier

I may need to provide a configuration option for specifying the absolute path to the htmlbeautifier executable.

@lallmon
Copy link
Author

lallmon commented Sep 16, 2014

@Glavin001

  • OSX Mavericks
  • 0.11.1
  • I have both a .bash_profile and .bashrc
  • /Users/Lucas/.rvm/gems/ruby-2.1.2/bin/htmlbeautifier

I was going to suggest the absolute path option. Until then, is there a place I may be able to set it within the code?

@Glavin001
Copy link
Owner

You could manually set the absolute path for htmlbeautifier here: https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/html-erb-beautify.coffee

I will add the absolute path as an option in a future patch. Let me know if you have any questions / problems until then.

@dustintheweb
Copy link

@Glavin001 can you post a snippet of exactly where/how I should add my absolute path in that coffee file? I have the exact same issue as listed above & would love to use this plugin on .erb files

@afomi
Copy link

afomi commented Dec 21, 2014

I ran into @Lucaska' error too. Atom didn't seem to be picking up the directory where the htmlbeautifier gem was installed, so I manually added the path to my .bash_profile, and Atom was able to find it, which resolved this error. I assume you could add it to your .zshrc as well.

For me, I added this to .bash_profile. Which works, but is pretty brittle, given it'll break when I update ruby in .rvm. Good enough for now. A custom path option would be welcomed 👍

export PATH="$PATH:/Users/username/.rvm/gems/ruby-2.1.5/bin/"

I chose this path because which htmlbeautifier returned /Users/username/.rvm/gems/ruby-2.1.5/bin/htmlbeautifier

@williambout
Copy link

@Glavin001 It would be great to have the ability to change the path directly in Atom Beautify settings.

@Glavin001
Copy link
Owner

@williamtrennem I'll add that to #164

@Willibaur
Copy link

@Glavin001 Have you added that ability to include path directly on Atom Beautify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants