JS Beautifier and @media screen rule

Started by paw, June 15, 2015, 08:10:35 PM

Previous topic - Next topic

paw

Hi there

When I format CSS by JS Beautifier, all @media screen rule go like this -

before format = @media screen and (min-width: 320px) and (max-width: 750px) {...}

after format = @media screen and(min-width: 320px) and(max-width: 750px) {...}

Can you please point me out how to maintain space between "and (" when I format CSS with JS Beautifier?

Thanks much!

alex

Hi,

as one can guess, JS Beautifier code belongs not to me, but to http://jsbeautifier.org/ ;) It is just wrapped by HippoEDIT as plugin.
What I see, there is no way to modify the behaviour with this beautifier version. But after some investigation I have found that with current from github that shall work.

Unfortunately, it is not so easy to JSBeautifier in compatible way and I need to do some adjustments for HippoEDIT scripting engine. So, probably you can get fixed plugin after next build.

If you can not wait, you can change it by yourself:
- you need to replace file beautify-css.js with one from GitHub.
- define in the beginning of it
Code (javascript) Select
var global = {};
- replace in file beautify.hejs:
Code (javascript) Select
text = css_beautify(text, options);
by
Code (javascript) Select
text = global.css_beautify(text, options);

than shall work. Plugins path can be found in settings Tools->Options->Plugins (List)->
  • JS Beautifier

    BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

paw

Hi Alex

Thanks much. Appreciate your reply.

Already tried. But it's not working. Probably I'm not reading hard enough your instruction. Will try it again when I get home this evening. Happy to hear that you're going to get fixed it in next build.

alex

Strange. By me was working (but only for file beautifycss.js, because one can not define two globals -> they will overwrite each other).
Maybe you have not restarted?

Nevertheless - I will publish update to plugin after new build of HE.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]