Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

40
Views
Reindent minified Javascript with Sublime

Let's say you have an example.js file open in SublimeText:

function foo(bar){a=1;b=2;for(var i=0;i<100;i++){console.log(i);};}

How to automatically have an indented code with SublimeText? such as:

function foo(bar) {
    a=1;
    b=2;
    for (var i=0;i<100;i++) {
        console.log(i);
    };
}

I tried Edit > Line > Reindent or CTRL+SHIFT+P Reindent but it does nothing on this code. Why?

How is this possible without a third-party package requiring node.js installed (such as HTML-CSS-JS Prettify)?

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

Since you don't want a Node.js server running just for formatting, and because it works really well for me, I'd recommend checking out JsFormat. I looked through the source, and the only .js files I could find are for testing -- everything else, including the underlying jsbeautifier library, is written in Python, so it'll run as a native plugin.

7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs