Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to less functions paramters braces #568

Closed
wants to merge 3 commits into from

Conversation

lejenome
Copy link
Contributor

this PR adds better support for less functions braces (no new lines between function parameters)
e.g: the new code outputs this

.box-shadow(@shadow: 0 1px 3px rgba(0, 0, 0, .25)) {
    -webkit-box-shadow: @shadow;
    -moz-box-shadow: @shadow;
    box-shadow: @shadow;
}

and the old code outputs this:

.box-shadow(@shadow: 0 1px 3px rgba(0,
0,
0,
.25)) {
    -webkit-box-shadow: @shadow;
    -moz-box-shadow: @shadow;
    box-shadow: @shadow;
}

} else if (ch === ',') {
output.push(ch);
eatWhitespace();
if (!insideRule && selectorSeparatorNewline) {
if (!insideRule && selectorSeparatorNewline && roundBraceLevel < 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Round brace"... do you mean parenthesis?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call them that then. 😄
You can say call it parenLevel if you like. roundBraceLevel is odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok done

@bitwiseman
Copy link
Member

Thanks for the PR. You have tests and updated python, too. Very cool.
Naming question... And I need to look at it a little more closely before merging.

@lejenome
Copy link
Contributor Author

There is a test not supported yet. given:

.tabs   ( ) { }

the code will output (1 space between function name and parenthesis)

.tabs () {}

instead of

.tabs() {}

@c32hedge
Copy link
Contributor

Is it just me or does it look like the build failure was unrelated to the changed code? Did Travis just flake out?

@lejenome
Copy link
Contributor Author

It's an error on node's npm, unrelated to js-beautify code

@bitwiseman bitwiseman closed this in 2b13664 Mar 6, 2015
@bitwiseman bitwiseman added this to the v1.5.5 milestone Mar 6, 2015
@bitwiseman
Copy link
Member

@lejenome - I've merged your change. Thanks!

It turned on the test you said was failing, just to encode the behavior. It might be incorrect but it isn't horrible or a syntax error. We can address it later. Please file an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants