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

Offline paw

  • Registered User
  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
JS Beautifier and @media screen rule
« on: June 15, 2015, 07: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: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: JS Beautifier and @media screen rule
« Reply #1 on: June 15, 2015, 10: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
    • View Profile
Re: JS Beautifier and @media screen rule
« Reply #2 on: June 16, 2015, 12: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: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: JS Beautifier and @media screen rule
« Reply #3 on: June 16, 2015, 01: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.

 

Related Topics

  Subject / Started by Replies Last post
1 Replies
1900 Views
Last post August 06, 2009, 10:28:20 pm
by alex
1 Replies
2800 Views
Last post May 11, 2010, 12:20:49 am
by alex
4 Replies
2378 Views
Last post May 09, 2013, 10:32:29 pm
by alex
7 Replies
2337 Views
Last post February 26, 2013, 11:09:33 pm
by alex
6 Replies
1458 Views
Last post July 18, 2016, 11:33:24 pm
by Disker