Js-beautify: Agregue la opción para mantener reglas de una sola línea en CSS

Creado en 3 dic. 2017  ·  4Comentarios  ·  Fuente: beautify-web/js-beautify

Descripción

¡Saludos!

si tengo esto
footer { padding: 1%; }

luego, después de Shift + Alt + FI obtener

    footer {
        padding: 1%;
    }

¿Existe una opción para mantener la 'regla de una línea' como está?

Intentado

"beautify.options": {"brace_style": "collapse,preserve-inline"}

pero no suerte

Ajustes

 {
    "window.zoomLevel": -1,
    "workbench.sideBar.location": "right",
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 1000,
    "editor.cursorStyle": "underline",
    "liveServer.settings.donotShowInfoMsg": true,
    "liveServer.settings.donotVerifyTags": false,
    "html.format.contentUnformatted": "pre,code,textarea,li",  
}
css blocked enhancement

Comentario más útil

Tal vez debería ser una opción como max_preserve_single_line_properties configurada con el número máximo de propiedades para mantener en una sola línea.

Formateado:

.fill {
    flex: 1 1 auto;
}

.item-name input {
    font-size: 1.5em;
}

.avatar {
    border-radius: 50%;
    margin-right: 10px
}

.avatar-32 {
    width: 32px;
    height: 32px
}

.avatar-64 {
    width: 64px;
    height: 64px
}

.avatar-100 {
    width: 100px;
    height: 100px
}

.avatar-128 {
    width: 128px;
    height: 128px
}

.details {
    padding: 2em;
}

.form-actions {
    direction: rtl;
}

Resultado deseado:

.fill { flex: 1 1 auto; }
.item-name input { font-size: 1.5em; }

.avatar { border-radius: 50%; margin-right: 10px }
.avatar-32 { width: 32px; height: 32px }
.avatar-64 { width: 64px; height: 64px }
.avatar-100 { width: 100px; height: 100px }
.avatar-128 { width: 128px; height: 128px }

.details { padding: 2em; }
.form-actions { direction: rtl; }

Todos 4 comentarios

Esto está relacionado con # 1124, pero separado ya que solo pide conservar las reglas de una línea.
Ninguno de los dos está presente en este momento.

¡Gracias por la respuesta @bitwiseman ! :)

Tal vez debería ser una opción como max_preserve_single_line_properties configurada con el número máximo de propiedades para mantener en una sola línea.

Formateado:

.fill {
    flex: 1 1 auto;
}

.item-name input {
    font-size: 1.5em;
}

.avatar {
    border-radius: 50%;
    margin-right: 10px
}

.avatar-32 {
    width: 32px;
    height: 32px
}

.avatar-64 {
    width: 64px;
    height: 64px
}

.avatar-100 {
    width: 100px;
    height: 100px
}

.avatar-128 {
    width: 128px;
    height: 128px
}

.details {
    padding: 2em;
}

.form-actions {
    direction: rtl;
}

Resultado deseado:

.fill { flex: 1 1 auto; }
.item-name input { font-size: 1.5em; }

.avatar { border-radius: 50%; margin-right: 10px }
.avatar-32 { width: 32px; height: 32px }
.avatar-64 { width: 64px; height: 64px }
.avatar-100 { width: 100px; height: 100px }
.avatar-128 { width: 128px; height: 128px }

.details { padding: 2em; }
.form-actions { direction: rtl; }

Esto requerirá al menos una tokenización CSS para que funcione (# 545). Una vez que lo tengamos, esto se implementará de la misma manera que en el lado de javascript.

¿Fue útil esta página
0 / 5 - 0 calificaciones