Js-beautify: Option hinzufügen, um einzeilige Regeln in CSS beizubehalten

Erstellt am 3. Dez. 2017  ·  4Kommentare  ·  Quelle: beautify-web/js-beautify

Beschreibung

Grüße!

wenn ich das habe
footer { padding: 1%; }

dann nach Shift+Alt+FI get

    footer {
        padding: 1%;
    }

Gibt es eine Option, die 'One-Line-Regel' so zu belassen, wie sie ist?

Versucht

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

aber kein glück

Einstellungen

 {
    "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

Hilfreichster Kommentar

Vielleicht sollte es eine Option wie max_preserve_single_line_properties , die mit der maximalen Anzahl von Eigenschaften konfiguriert ist, die in einer einzigen Zeile gehalten werden können.

Formatiert:

.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;
}

Erwünschtes Ergebnis:

.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; }

Alle 4 Kommentare

Dies hängt mit #1124 zusammen, ist jedoch getrennt, da es nur darum bittet, einzeilige Regeln beizubehalten.
Beide sind derzeit nicht anwesend.

Danke für die Antwort @bitwiseman ! :)

Vielleicht sollte es eine Option wie max_preserve_single_line_properties , die mit der maximalen Anzahl von Eigenschaften konfiguriert ist, die in einer einzigen Zeile gehalten werden können.

Formatiert:

.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;
}

Erwünschtes Ergebnis:

.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; }

Dies erfordert mindestens eine CSS-Tokenisierung, damit es funktioniert (#545). Sobald wir das haben, wird dies auf die gleiche Weise wie auf der Javascript-Seite implementiert.

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen