Skip to content

Add better support for minified inputs #1

@titpetric

Description

@titpetric

It's very common to compact css to single lines in tests, e.g.

.classname { font-weigth: bold; color: #f70; a { text-decoration: underline } }

This is both valid css and less (lessc passes the compilation). Lessgo doesn't do so well since the parser is based on newline information, and doesn't consider braces or underscores when parsing documents.

The issue is generally easy to fix just by injecting some newlines after {, ;, } and also before } (the last statement ; is optional). The tooling should be able to consume "minified" sources.

TODOs:

  1. Replicate issue
  • add a fixture test with single-line less source code
  • expectation: lessc passes compilation
  • expectation: lessgo errors
  1. Adjust implementation
  • patch any css []byte into a well indented version ready for parsing, adding whitespace to sanitize the input
  • make fixture test / integration test with lessc and lessgo pass, outputs must match
  1. Testing
  • any existing tests should pass without modification to the test
  • tests should not be skipped or otherwise disabled
  • follow existing coding and testing conventions, testify/require usage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions