Giter VIP home page Giter VIP logo

grunt-jsbeautifier's People

Contributors

alberto-chiesa avatar bartvds avatar bitwiseman avatar blai avatar davdiv avatar johnkpaul avatar mitermayer avatar vkadam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-jsbeautifier's Issues

maxPreserveNewlines doesn't seem to do anything

I have the following Gruntfile.coffee:

module.exports = (grunt) ->
  grunt.initConfig

    app:
      cssFileTypes: [
        './app/assets/stylesheets/**/*.css'
      ],
      jsFileTypes: [
        './app/assets/javascripts/**/*.js',
        './app/assets/javascripts/**/*.erb'
      ],
      coffeeFileTypes: [
        './app/assets/javascripts/**/*.coffee'
      ],
      htmlFileTypes: [
        './app/views/**/*.html',
        './app/views/**/*.erb',
        './app/views/**/*.haml',
        './app/views/**/*.hamlc'
      ]

    jsbeautifier:
      files: [
        '<%= app.jsFileTypes %>',
        '<%= app.cssFileTypes %>',
        './app/views/**/*.html'
      ]
      options:
        js:
          fileTypes: [
            '.js.erb'
          ]
          indentSize: 2
          maxPreserveNewlines: 1
        css:
          indentSize: 2
          maxPreserveNewlines: 1
        html:
          fileTypes: [
            '.erb',
            '.html.erb',
            '.haml',
            '.html.haml',
            '.hamlc',
            '.html.hamlc'
          ]
          indentSize: 2
          maxPreserveNewlines: 1
          braceStyle: 'end-expand'
          unformatted: [
            'inline',
            '%'
          ]

    copy:
      inplace:
        files: [
          expand: true
          src: [
            '<%= app.jsFileTypes %>',
            '<%= app.cssFileTypes %>',
            '<%= app.htmlFileTypes %>'
          ]
        ]
        options:
          process: (content, filepath) ->
            # Remove excess lines from end of file
            if /\n+$/.test(content)
              content = content.replace(/\n+$/, '')
            # Remove trailing whitespace
            if /\s+$/gm.test(content)
              content = content.replace(/\s+$/gm, '')
            # Replace tabs with 2 spaces
            if /\t/gm.test(content)
              content = content.replace(/\t/gm, '  ')
            # Add newline at end of file
            content + '\n'

    lintspaces:
      all:
        src: [
          '<%= app.jsFileTypes %>',
          '<%= app.cssFileTypes %>',
          '<%= app.htmlFileTypes %>'
        ]
        options:
          newline: true
          trailingspaces: true
          indentation: 'spaces'
          spaces: 2
          ignores: [
            'js-comments',
            'html-comments',
            'ruby-comments'
          ]

    jshint:
      all: ['<%= app.jsFileTypes %>']

    coffeelint:
      app: ['<%= app.coffeeFileTypes %>'],
      options:
        'max_line_length':
          'level': 'ignore'

    watch:
      files: [
        '<%= app.jsFileTypes %>',
        '<%= app.cssFileTypes %>',
        '<%= app.htmlFileTypes %>'
      ]
      options:
        atBegin: true
        debounceDelay: 5000
      tasks: [
        'jsbeautifier',
        'copy',
        'lintspaces'
      ]

  require('matchdep').filterDev('grunt-*').forEach grunt.loadNpmTasks
  grunt.registerTask 'default', ['watch']

I don't think maxPreserveNewlines is working for any of the file types. I'm expecting it to leave one line between blocks of code where someone else left a bunch of lines first. For instance:

foo.html.erb

<p>


Hello




</p>

Would turn into..

<p>

Hello

</p>

I'd love any help you can offer.

make the config compatible with jshint

hi,

jshint expects identifiers to be in camelCase, but this tasks use underscores (for example: jslint_happy instead of jslintHappy.
this makes jshint fail when checking the Gruntfile.js with jsbeautifier options in it.

thanks!
dan

Ignoring embedded script tags (html)

Is is possible to ignore script tags embedded in a HTML page? I am using script tag contents as a Javascript template and this is necessary for the build. Any help you can give would be appreciated. Thanks!

Non-UNIX line endings causes verification to fail

Firstly, love this plugin.

JSBeautify specifications don't mention line endings, and as a point of reference, other tools such as HTML/JS/CSS Beautify in Sublime Text don't care about line endings. However, this plugin will fail verification if the line endings are not UNIX formatted, even if the files are otherwise identically formatted to other tools that format using JSBeautify.

Allow to write to `dest`

Most grunt plugins do not modify a file in-place. Can you add a dest option to output the beautified content?

{
  src: 'abc.min.js',
  dest: 'abc.js'
}

Wrong beatify on first line

The first line is like this:

/** or
define

sometimes, the three bytes have been deleted.

/**

  • xxx to * xxx
    */ */

or

define(function to ine(function

Only modify file when it is not well-formatted

To be more specific, we hope the formatter can leave those files that are already formatted untouched, and only modify those files that have to be changed.

This is an unobtrusive feature that does no side-effect harm to all users, but it would be a great feature when we use version control system (which is absolutely true). If and only if we have this feature, beautifier can be a routine process in default. Otherwise, we can only run jsbeautifier when we randomly remember it.

Less tighter js-beautify version dependency, update to 1.4.1+

Version 1.4.1 of js-beautify was released recently and currently it takes a change in sourcecode of grunt-jsbeautifier for every release.
Given the adherence to semantic versioning, could the dependency of grunt-jsbeautifier to js-beautify be simply "1.x" ? This would make update cycles much easier.

Grunt 1.0.x support

The module fails to install with Grunt 1.0.x. Are there plans to bring support to the newest version? Thanks for all the hard work!

Grunt 0.4 Release

I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.

If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.

If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8" as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0" to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.

Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.

Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!

If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.

Thanks, we really appreciate your work!

use jsbeautifier format the string which concatenation with "\" have one bug?

I found one bug like this

before

var stmt = " if(window.healthBtnClicked) {\
                                var paywin = ZDK.module.window({\
                                    title: 'title,\
                                    content: '',\
                                    cache: false,\
                                    width: 550,\
                                    cancel:'error,\
                                    ok: 'ok',\
                                    onInited: function(win) {\
                                        win.resetBody('issuccess?');\
                                    }\
                                });\
                                paywin.on('onok',function(){\
                                    $(window).trigger('payok');\
                                });\
                                window.open(json.msg);\
                            } else {\
                                window.location.href = json.msg;\
                            }";

after

var stmt = " if(window.healthBtnClicked) {\
var win = XX.module.window({\
                            title: 'title',
                            \
                            content: '',
                            \
                            cache: false,
                            \
                            width: 550,
                            \
                            cancel: 'cancel',
                            \
                            ok: 'ok',
                            \
                            onInited: function(win) {\
                                win.resetBody('is success?');\
                            }\
                        });\
                        paywin.on('onok', function() {\
                            $(window).trigger('payok');\
                        });\
                        window.open(json.msg);\
                    } else {\
                                window.location.href = json.msg;\
                            }";

some one have this question?

HTML Formatting Comments

Hey,

I noticed in my HTML files the following doesn't play well when it comes to indentation:

    <!--[if lt IE 9]>
<script src="bower_components/modernizr/modernizr.js"></script>
<![endif]-->

Do you know of any way to make it behave when comments like this are present, it indents the first line then doesn't indent the remaining 2 lines.

You can see an example of it here

VERIFY_ONLY should verify all files before failing

When I have 1+ files out of verification, it'd be nice if both were listed before failing in a non-forced run. Example w/ comments below.

$ grunt jsbeautifier:verify # Fails on first file
Running "jsbeautifier:verify" (jsbeautifier) task
Warning: app/assets/javascripts/CSVConvertor.js was not beautified Use --force to continue.

Aborted due to warnings.

$ grunt jsbeautifier:verify --force # Prints everything but doesn't fail
Running "jsbeautifier:verify" (jsbeautifier) task
Warning: app/assets/javascripts/CSVConvertor.js was not beautified Used --force, continuing.
Warning: app/assets/javascripts/ab_testing.js was not beautified Used --force, continuing.
Beautified 37 files, changed 0 files...OK

Done, but with warnings.

<3 -Tom

Add force option

like this https://github.com/gruntjs/grunt-contrib-jshint#force

I want to run the beautifier in a watch task. I have jshint, beautifier, and at the end a test.

I want the output from jshint and beautifier to show, but still run the tests if they fail. jshint have the force option, but not beautifier.

If you don't have time I could possibly add it in a PR, if you are willing to add it. Not sure when I'll have time though.

Option "eol" not working

I was wondering why the plugin ignores my configuration concerning the option "eol".
If I use "\r\n" as eol, everything works fine except by empty lines at the end of a file.
I took a look at the code. In line 98 - 101 of the file "lib/jsbeautifier.js" you're replacing the empty line at the end of a file. As you can see in line 100, you are using "\n" as the line terminator, without considering if there is any option about which line terminator should be used. The result is that everywhere in my code is "\r\n" used as the line terminator except the empty line at the end of the file.
I would recommend to check if the option "eol" is set instead of using always the same line terminator.

By the way: What is the purpose of this lines? If you set the option "endWithNewline" to true, the beautifier will insert an empty line with the correct line terminator at the end of the file. So in my mind you can cut these lines out because there is no really use...

I also figured out that the option "eol" get's overriden. If you trying to use "\n" as the line terminator, the plugin always use "\r\n". If you insert some bullshit like "\n" it works correctly.

Why require latest dependencies?

As per my comment here, I'm not sure why this package was switched to use the latest version of all dependencies? Now I get this every time I run npm install:

npm WARN unmet dependency /Users/Brian/Dropbox/Projects/L7/retriever/node_modules/grunt-jsbeautifier requires underscore.string@'latest' but will load
npm WARN unmet dependency /Users/Brian/Dropbox/Projects/L7/retriever/node_modules/underscore.string,
npm WARN unmet dependency which is version 2.3.3

Seems like it would make more sense to stick to some kind of predictable version strategy for dependencies?

run jsBeautifier on single file

I want that whenever my js file got changes I want to run beautifier on that file. I do not want to run on all js file.
I am using "watch" livereload for this purpose. what should I do ??

grunt.registerTask('singleJSBeautifier', "Add git revision number", function(filePath) {
//Code for running jsBeautifier on single file.????
});

option.dest output folder too

Hello,
If I have a file in a folder (for example src) in which I test and develop my package, and I define a folder (for example dist) in which all beautified pages must go, it will copy the folder too (dist/src/files).
Please, fix this.

These are the options I used:

jsbeautifier: { files: ['src/development.js'], options: { dest: 'dist', } }

It would be really nice if I can chose the filename to output maybe like in grunt-uglify:

build: { src: 'src/development.js', dest: '<%= pkg.name %>.min.js' }

bug(config): grunt-jsbeautifier doesn't support .jsbeautifyrc

1. Summary

Part of grunt-jsbeautifier documentation:

Recommended for version < 0.2.7, use .jsbeautifyrc for > 0.2.7

But grunt-jsbeautifier doesn't support .jsbeautifyrc.

2. Environment

  • Operating systems:
    • Windows 10 Enterprise LTSB 64-bit EN (local),
    • Ubuntu 14.04.5 LTS (Travis CI).
  • Node.js 9.11.1,
  • npm 5.8.0,
  • js-beautify 1.7.5,
  • grunt-jsbeautifier 0.2.13,
  • eclint (tool, that check EditorConfig settings) 2.6.0.

3. Configuration

Example configuration in SashaGruntJsBeautify branch of my demo repository:

.jsbeautifyrc file:

{
    "indent_with_tabs": true,
    "end_with_newline": true
}

SashaJsBeautify.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Sasha title</title>
</head>
<body>
    Example body text
</body>
</html>

.editorconfig:

[*]
indent_style = tab
insert_final_newline = true

Gruntfile.coffee:

module.exports = (grunt) ->

    grunt.loadNpmTasks('grunt-jsbeautifier')
    grunt.initConfig
        jsbeautifier:
            files: ['SashaJsBeautify.html']

4. Steps to reproduce

grunt jsbeautifier

Then check tabs and final newline via eclint:

eclint check

5. Expected behavior

If Gruntfile.coffee:

module.exports = (grunt) ->

    grunt.loadNpmTasks('grunt-jsbeautifier')
    grunt.initConfig
        jsbeautifier:
            options:
                html:
                    indentWithTabs: true
                    endWithNewline: true
            files: ['SashaJsBeautify.html']

or I run js-beautify CLI

js-beautify -rn SashaJsBeautify.html

No warnings and/or errors.

6. Actual behavior

Else Gruntfile.coffee:

module.exports = (grunt) ->

    grunt.loadNpmTasks('grunt-jsbeautifier')
    grunt.initConfig
        jsbeautifier:
            files: ['SashaJsBeautify.html']
  • Spaces doesn't convert to tabs,
  • final newline delete.
$ eclint check SashaJsBeautify.html
SashaJsBeautify.html
    05:01 ❌️ invalid indent style: space, expected: tab (EditorConfig indent_style         https://goo.gl/8Qkrbr)
    06:01 ❌️ invalid indent style: space, expected: tab (EditorConfig indent_style         https://goo.gl/8Qkrbr)
    10:01 ❌️ invalid indent style: space, expected: tab (EditorConfig indent_style         https://goo.gl/8Qkrbr)
    13:07 ❌️ expected final newline                     (EditorConfig insert_final_newline https://goo.gl/LRCZMy)

Look at this on Travis CI.

Thanks.

Space between function and ()

On http://jsbeautifier.org there seems to be another default setup according to space between function and () ...

I like to keep:

function () {
//stuff
}

but your grunt task outputs:

function() {
//stuff
}

I thought the option "keepFunctionIndentation" was right, but it maby is broken or I missunderstood what its doing.

Thanks for your plugin anyway.

Better changes report

grunt-jsbeautifier can report how many files were changed in the process, but it's not showing a report of the changes.

As soon as grunt-jsbeautifier and grunt-contrib-jshint together seems to be the best code smell remover and code standardization I could found (thanks to VERIFY_ONLY), what about providing a report in grunt-jsbeautifier, like grunt-contrib-jshint does?

I tried to sneak into js-beautify code to find out if it has some kind of support, but VERIFY_ONLY seems to be a feature of this project, not in the scope of js-beautify.

Use only Grunt supported config?

Hi! Thanks for writing this task!

I was helping a user today in irc #grunt with issues getting started with this jsbeautifier task. His confusion was because this task implements some custom config handling outside of what Grunt supports.

Would you mind updating the task to use this.files instead and support the src/dest ways to configure tasks that Grunt supports: http://gruntjs.com/configuring-tasks?

I've also written a blog post with more information about this: http://dontkry.com/posts/code/2013-04-24-use-this-files.html

Thanks for the consideration!

Hangs on missing HTML files

When the specified files can't be found by the multitask src configuration pattern, then jsbeautifier task starts some infinite loop in the background and it doesn't return immediately. To reproduce this bug, just use the following simple HTML configuration:

jsbeautifier: {
  html: {
    src: ["app/views/*.html"]
  }
}

and leave the src folder empty.
Now, try run grunt jsbeautifier:html and it'll never return - will hang forever.

Some intolerable fact

I run jsbeautify on my web server, then some jpg files have been modified, the jpg files can't be open normally.

Seems we need a exclude option to skip some folders, some files, such as node_modules folder and jpg,png files etc, it could be setting by user.

Beautifies .catch(); to . '\n' catch ()

In my emberjs app I'm using .catch for my promise fails and jsbeautifier turns

.catch(this.failValidation.bind(this));

to

 .
      catch (this.failValidation.bind(this));

bracestyle expand causing odd formatting with JSON objects

I have found a couple of scenarios where using the bracestyle expand when formatting .js code causes a few odd results.

Consider the following:

var x = y || {};

this seems to result in the following code (which looks a little clumsy):

var x = y || 
{};

It would be nice if the bracing was left untouched after the logical OR operand in these scenarios

ES6 modules support

Hey there,

I would like to use jsbeautifier with ES6 modules :) any plan for this feature ?

Thanks

bug(options): wrapLineLength: 0 not by default

1. Summary

Default options documentation.

But wrapLineLength: 0 not default as it is written in documentation.

2. Environment

  • Operating systems:
    • Windows 10 Enterprise LTSB 64-bit EN (local)
    • Ubuntu 14.04.5 LTS (Travis CI)
  • Node.js 10.0.0
  • npm 5.8.0
  • js-beautify 1.7.5
  • grunt-jsbeautifier 0.2.13
  • eclint (tool, that check EditorConfig settings) 2.7.0

3. Configuration

See example configuration in SashaJsBeautifyTabs branch of my demo repository:

.travis.yml:

language: node_js

node_js:
- node

install:
- npm install -g eclint grunt-cli
- npm install

script:
- grunt jsbeautifier
- eclint check SashaJsBeautifyTabs.html

SashaJsBeautifyTabs.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
But <a href="https://productforums.google.com/d/msg/docs/YJ09uwy-pWU/g_1AJTXZN6QJ" target="_blank">notifications are only sent to the email address associated with your Google account</a>. <a href="https://support.google.com/mail/answer/10957?hl=en" target="_blank">mail forwarding</a>
</body>
</html>

.editorconfig:

[*]
indent_style = tab
insert_final_newline = true

4. Steps to reproduce

grunt jsbeautifier

eclint check SashaJsBeautifyTabs.html

5. Expected behavior

If Gruntfile.coffee:

module.exports = (grunt) ->

    grunt.loadNpmTasks('grunt-jsbeautifier')
    grunt.initConfig
        jsbeautifier:
            options:
                html:
                    indentWithTabs: true
                    endWithNewline: true
                    wrapLineLength: 0
            files: ['SashaJsBeautifyTabs.html']

or:

js-beautify -rn SashaJsBeautify.html

Modified SashaJsBeautifyTabs.html:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    But <a href="https://productforums.google.com/d/msg/docs/YJ09uwy-pWU/g_1AJTXZN6QJ" target="_blank">notifications are only sent to the email address associated with your Google account</a>. <a href="https://support.google.com/mail/answer/10957?hl=en" target="_blank">mail forwarding</a>
</body>

</html>

See Travis CI build.

6. Actual behavior

Else Gruntfile.coffee:

module.exports = (grunt) ->

    grunt.loadNpmTasks('grunt-jsbeautifier')
    grunt.initConfig
        jsbeautifier:
            options:
                html:
                    indentWithTabs: true
                    endWithNewline: true
            files: ['SashaJsBeautifyTabs.html']

Modified SashaJsBeautifyTabs.html:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    But <a href="https://productforums.google.com/d/msg/docs/YJ09uwy-pWU/g_1AJTXZN6QJ" target="_blank">notifications are only sent to the email address associated with your Google account</a>. <a href="https://support.google.com/mail/answer/10957?hl=en"
        target="_blank">mail forwarding</a>
</body>

</html>

Spaces before target="_blank", despite the fact that indentWithTabs: true:

See Travis CI build.

Thanks.

new lines on unix vs windows

We have both windows and mac/linux developers. The new line on mac is different than windows and this is causing issues at each run. It shows every developer that all the files have been beautified when the difference is only the new line characters. Is there any way to standardize the output of this plugin to generate the same new line characters for windows and mac?

JS: End with newline

Hi! Thanks for writing this task!

I was wondering why I can't use this option:
https://github.com/beautify-web/js-beautify/blob/master/js/lib/beautify.js#L75

Then I figured it out that the task allways inserts a newline after beautifying a JavaScript file - something that I dont't want to. It is unfortunately impossible to configure it with the parameter options. Could you please change this?

Here is the code that I mean:

return [jsBeautify.js, config.js, true];

and here:

// jsbeautifier would skip the line terminator for js files

Clarification on contents of .jsbeautifyrc / config setup

After struggling with the exact layout of the configuration for the multitasks, I am a bit puzzled about the expected schema of .jsbeautifyrc:
The homepage specifies a flat layout of the options. But the task expects this file to have a first level layout of js/css/html first, then specifying the parameters (per type). First the file is read directly and the three types are used.

If I provide a JSON file with the flat layout, no options will be passed on and js-beautify runs with its default options.

So far this rather seems like a bug to me, I guess the config handling should be along the lines of

if (params.config) {
  var baseConfig = grunt.file.readJSON(path.resolve(params.config));
  config = {js: {}, css: {}, html: {}};
  grunt.util._.extend(config.js, baseConfig);
  grunt.util._.extend(config.css, baseConfig);
  grunt.util._.extend(config.html, baseConfig);
  grunt.util._.extend(config.js, params.js);
  grunt.util._.extend(config.css, params.css);
  grunt.util._.extend(config.html, params.html);
...

(quick example code)

Improve documentation

Hi all!
I'm working in a project where we are using jsbeautifier.
I really didn't know what jsbeautifier do, so, I come here looking for some kind of documentation to understand what does this library do.

But... There is no place in the whole README where you say what this library do.

Can you let us know what is jsbeautifier?
Thank you.

js-beautify version

Last version seems to be [email protected] is it possible to update or to use a differents version ?
or to use the global version already installed in the system ?

Regards,
Cedric

Config file

Hi!

I have a .jsbeautifyrc file with the following content:

{
    "js": {
        "indentSize": 2,
        "indentChar": " ",
        "preserveNewlines": true,
        "maxPreserveNewlines": 2
    },
    "css": {
        "indentSize": 2,
        "indentChar": " ",
        "preserveNewlines": true,
        "maxPreserveNewlines": 1
    },
    "html": {
        "indentSize": 2,
        "indentChar": " ",
        "preserveNewlines": true,
        "maxPreserveNewlines": 1
    }
}

Target:

    jsbeautifier: {
      options: {
        config: '.jsbeautifyrc'
      },
      files: [
        '<%= config.srcPath %>/css/app.scss'
      ]
    },

app.scss:

@import 'const';

/* Main */

html {
    height: 100%;
}

body {
    height: 100%;
    margin: 0px;
    padding: 0px;
    background-color: $google-maps-background-color;
}

When I run the target above I get my css scrambled. Output:

@import 'const'; /* Main */ html { height: 100%; } body { height: 100%; margin: 0px; padding: 0px; background-color: $background-color; }

With -v option I see the output:

Beautify config before converting camelcase to underscore: {"js":{"js":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":2},"css":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"html":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":2,"fileTypes":[".js",".json"]},"css":{"js":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":2},"css":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"html":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1,"fileTypes":[".css"]},"html":{"js":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":2},"css":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"html":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1,"fileTypes":[".html"]}}

Using beautify config: {"js":{"js":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":2},"css":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"html":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"fileTypes":[".js",".json"],"indent_size":2,"indent_char":" ","preserve_newlines":true,"max_preserve_newlines":2},"css":{"js":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":2},"css":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"html":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"fileTypes":[".css"],"indent_size":2,"indent_char":" ","preserve_newlines":true,"max_preserve_newlines":1},"html":{"js":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":2},"css":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"html":{"indentSize":2,"indentChar":" ","preserveNewlines":true,"maxPreserveNewlines":1},"fileTypes":[".html"],"indent_size":2,"indent_char":" ","preserve_newlines":true,"max_preserve_newlines":1}}

The properties in the final config doesn't get merged, they are multiplied(Just the output above formatted):

{
    "js": {
        "js": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 2
        },
        "css": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 1
        },
        "html": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 1
        },
        "indentSize": 2,
        "indentChar": " ",
        "preserveNewlines": true,
        "maxPreserveNewlines": 2,
        "fileTypes": [".js", ".json"]
    },
    "css": {
        "js": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 2
        },
        "css": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 1
        },
        "html": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 1
        },
        "indentSize": 2,
        "indentChar": " ",
        "preserveNewlines": true,
        "maxPreserveNewlines": 1,
        "fileTypes": [".css"]
    },
    "html": {
        "js": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 2
        },
        "css": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 1
        },
        "html": {
            "indentSize": 2,
            "indentChar": " ",
            "preserveNewlines": true,
            "maxPreserveNewlines": 1
        },
        "indentSize": 2,
        "indentChar": " ",
        "preserveNewlines": true,
        "maxPreserveNewlines": 1,
        "fileTypes": [".html"]
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.