Code Monkey home page Code Monkey logo

Comments (1)

aaronblohowiak avatar aaronblohowiak commented on September 28, 2024

Maybe I should change the way the "-" works.

It is different from ruby haml -- it begins a block of inline javascript.

So, if you want to use it with conditionals, you cannot indent the contents.

- if (true){
%h1 Will work
- }

demonstrating blocks and nesting:

- a = 4;
  b = a % 2;
  if (b >= a){
.someDiv
  %h1 Will work
- }

This is a little awkward, yes, but you only need to do this if you need an
:else.. adding :else to the compiler is actually quite tricky given the way
it is currently implemented :/

  • Aaron

On Wed, Sep 28, 2011 at 2:30 AM, Ivan Torres <
[email protected]>wrote:

Hey Aaron,

I don't know if this is an issue, or I'm doing something wrong. But if you
indent an if block it does generates invalid JS:

- if (true) {
 %h1 Wont Work
- }

This is what I get:

return "";if (error !== undefined) {
- if (true) {
 %h1 Wont Work
- };
_$output = _$output  +
"";}; _$output = _$output ; }};

BTW I'm using haml.compile

Also, it would be nice to have a :elsif or :else ifplugin ;)

Reply to this email directly or view it on GitHub:
#49

from haml-js.

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.