1

I'm creating an element with the dart:html lib. I'd like the indentation to be pretty on the Dart side, but as a matter of keeping the generated js as compact as possible, I'd like the compiler to clean up the string removing unnecessary spaces.

elem = Element.html(
    '''
    <div class="modal" style="display: none;">
        <div class="modal-content">
          <span id="modal-close" class="close">&times;</span>
          <p>This is a test</p>
        </div>       
        <style>
          .modal-content {
            background-color: #fefefe;
            margin: 15% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 590px;
            height: 800px;
          }
        </style>
    </div>
   ''';

This minified generated code looks like:

s=W.h9('        <div class="modal" style="display: none;">\n            <div class="modal-content">\n              <span...

Basically all whitespaces remain. Although I'm sure gzip handles those whitespaces quite efficiently, I was wondering if there is any kind of preprocessing step where I could plug a cleanup phase, or any other mean to do it.

maphe
  • 1,904
  • 3
  • 20
  • 26

0 Answers0