question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS: Preserve Newlines

See original GitHub issue

Maybe I’m not configuring it correctly, or maybe it’s missing, but I have a great need for preserving my newlines in my css and can’t seem to get it to work.

Here’s my config:

"css": {
  "allowed_file_extensions": ["css", "scss", "sass", "less"],
  "end_with_newline": true,
  "indent_char": " ",
  "indent_size": 2,
  "selector_separator": " ",
  "selector_separator_newline": false,
  "preserve_newlines": true
}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:11
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
darlanalvescommented, Jan 26, 2015

+1² for SCSS files.

Issue #563 also has a similar problem. When I save/format a .scss file, the variables at the top and the import calls are all put together, making it hard to maintain. Would be super to just detect empty lines and keep them 👍

Just for reference:

@import "config";

$background: #ececec;
$color: #00aec8;

body {
    font-size: $font-size;
}

… goes like this:

@import "config";
$background: #ececec;
$color: #00aec8;
body {
    font-size: $font-size;
}
1reaction
bitwisemancommented, Mar 27, 2019

@reza3vi What are you +1-ing? This is fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

white-space
The CSS white-space property controls how text is handled on the element ... As per the CSS 2.1 spec: “Lines are broken at...
Read more >
How to preserve line breaks in <code> block? - css
How to preserve line breaks in <code> block? · If the line breaks are meaningful, then they are "content," not "style," and should...
Read more >
Preserve new lines and spacing in CSS - Dev Diary
See how you can preserve the new lines and spacing of text in HTML by using the white-space CSS property.
Read more >
How to Render an HTML String Preserving Spaces and ...
In this tutorial, you can learn how to render an HTML text preserving spaces and line breaks. You need to use the HTML...
Read more >
Preserve Newlines
Preserve line-breaks. Configuration option for beautifiers JS-Beautify and languages CSS, EJS, HTML, Handlebars, JSX, JavaScript, Liquid, Mustache, XML.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found