Author Topic: JS Beautifier and @media screen rule  (Read 2893 times)

Offline paw

  • Registered User
  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
JS Beautifier and @media screen rule
« on: June 15, 2015, 08:10:35 PM »
Hi there

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

before format =
Code: [Select]
@media screen and (min-width: 320px) and (max-width: 750px) {...}
after format =
Code: [Select]
@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!

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2212
  • Karma: +37/-3
    • HippoEDIT
Re: JS Beautifier and @media screen rule
« Reply #1 on: June 15, 2015, 11:49:34 PM »
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
  1. var global = {};
- replace in file beautify.hejs:
Code: Javascript
  1. text = css_beautify(text, options);
by
Code: Javascript
  1. text = global.css_beautify(text, options);

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


BR, Alex.
 

Offline paw

  • Registered User
  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: JS Beautifier and @media screen rule
« Reply #2 on: June 16, 2015, 01:54:22 AM »
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.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2212
  • Karma: +37/-3
    • HippoEDIT
Re: JS Beautifier and @media screen rule
« Reply #3 on: June 16, 2015, 02:25:47 PM »
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.