GithubHelp home page GithubHelp logo

Comments (4)

netzpirat avatar netzpirat commented on July 21, 2024

Thats strange, I can paste the above template and it'll compile fine into a JST:

function (context) {
    var fn;
    fn = function(context) {
      var e, item, o, _i, _len, _ref2;
      o = [];
      e = HAML.escape;
      o.push("<div id='cart'>");
      o.push("  <h2>" + (e(I18n.t('js.cart.title'))) + "</h2>");
      if (this.cart.length === 0) {
        o.push("  <p class='empty'>" + (e(I18n.t('js.cart.empty'))) + "</p>");
      } else {
        o.push("  <ul>");
        _ref2 = this.cart;
        for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
          item = _ref2[_i];
          o.push("    <li>");
          o.push("      <div class='item'>");
          o.push(e("        " + item.name));
          o.push("        <a href='/cart/item/remove/" + item.id + "'>");
          o.push(e("          " + I18n.t('js.cart.item.remove')));
          o.push("        </a>");
          o.push("      </div>");
          o.push("    </li>");
        }
        o.push("  </ul>");
      }
      o.push("</div>");
      return o.join("\n");
    };
    return fn.call(App.application.globalTemplateContext(context));
  }

Empty lines are removed completely.

I did a quick test with whitespace and noticed the following:

  • Really empty lines are omitted
  • Proper indented "empty" lines are outputted.
  • Incorrect indented "empty" lines break compilation.

I have changed haml-coffee to drop lines that contains only whitespace (expect within a filter): netzpirat/haml-coffee@68a3cfe

from haml_coffee_assets.

netzpirat avatar netzpirat commented on July 21, 2024

I will push the update to the gem when we have resolved #3.

from haml_coffee_assets.

netzpirat avatar netzpirat commented on July 21, 2024

This is also fixed in 0.2.3

from haml_coffee_assets.

thibaudgg avatar thibaudgg commented on July 21, 2024

Yeah, works great too!

from haml_coffee_assets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.