mnussbaumer / cssex

An Elixir based and opinionated way to write CSS
MIT License
20 stars 0 forks source link

Allow more than 1 semicolon instead of failing #49

Closed mnussbaumer closed 6 months ago

mnussbaumer commented 6 months ago

For purposes of IDE formatting it's easier if every line is ended with a semicolon - this allows using basic SCSS/SASS formatters/modes that simply tab and ident correctly the code. The issue is that when using blocks/functions that return further CSS it might happen that the returned code is simply properties that are already finished by semicolon on each line, and as such we can't add a new semi-colon after the function call as that would end up with two semicolons and error, which also makes some formatting off as it interprets the line as not being ended.

An example:

@fn enforce_size(what, size) ->
  "#{what}: #{size};" <>
  "min-#{what}: #{size};" <>
  "max-#{what}: #{size};"
end;

To call this function we would do:

@fn::enforce_size(width, 50%)

If we put a semicolon after it errors out and if we don't the code formatter has no way of knowing if it's a well formed/valid line since it has not end of line marker.

mnussbaumer commented 6 months ago

Solved by https://github.com/mnussbaumer/cssex/pull/52