Closed eclectic-coding closed 3 years ago
Yup they're definitely caused by those conditionals. It's been annoying me for a while but I don't how how we can fix it. Any ideas?
@ayushn21 this should fix it:
<% if options["use-postcss"] -%>
"postcss": "^8.3.0",
"postcss-flexbugs-fixes": "^4.1.0",
"postcss-loader": "^4.3.0",
"postcss-preset-env": "^6.7.0",
<% else -%>
"sass": "^1.32.8",
"sass-loader": "^8.0.2",
<% end -%>
im not at a computer to test it, but generally the -
before the %
will strip out new lines.
https://ruby-doc.org/stdlib-3.0.2/libdoc/erb/rdoc/ERB.html
you can also use a starting: -
like this:
<%- else -%>
I think both syntaxes work.
I never knew that ... pretty slick. Thanks @ParamagicDev
@ayushn21 I will take care of the PR
TIL @ParamagicDev, Thanks!
Thanks @eclectic-coding :)
Could you make the change in this file at the same time as well please? @eclectic-coding
Thanks :)
FYI ... <% if options["use-postcss"] -%>
will only remove the empty line, but not the preceeding spaces:
"mini-css-extract-plugin": "^1.3.1",
"postcss": "^8.3.0",
But <%- if options["use-postcss"] -%>
will remove both. Pretty flexible, gotta love Ruby.
When creating a new project:
bridgetown new my_awesome_site
, there are blank lines in thedevDependencies
section of thepackage.json
. This does not affect the performance or stop the server, it is just an anomaly.Bridgetown Version: 0.21.3
Current behavior
Additional context The blank lines are probably caused by the conditionals found in json.erb:
Computing environment (please complete the following information):