creationix / haml-js

Haml ported to server-side Javascript. This is a traditional server-side templating language. Tested with node-js
MIT License
902 stars 110 forks source link

Attribute with no value is being stripped from output #82

Open mattymess opened 10 years ago

mattymess commented 10 years ago

To preface this issue, it's an AngularJS template, which is why I have the attribute with no value.

Given the following HAML...

.col-sm-4.center-block
  %div(ui-view)

...or given this...

.col-sm-4.center-block
  %div{"ui-view" => ""}

...outputs...

<div class=\"col-sm-4 center-block\"><div></div></div>

I want the output to be:

<div class=\"col-sm-4 center-block\"><div ui-view></div></div>

Is this a bug or am I missing some option that I need to pass when I render?

sirganya commented 9 years ago

I had to add a placeholder to my directive and remove it after compilation using gulp.

https://www.npmjs.com/package/gulp-replace-task

stugol commented 7 years ago

It's been over 2 years, and this is STILL not fixed? Is the project totally dead?

jtomaszewski commented 7 years ago

Duplicate of https://github.com/creationix/haml-js/issues/63 , one of these issues should be closed.

This is fixed in https://github.com/deskfed/haml-js/commit/e5e12e8967fd90fe2fbd56221eb2afe956f58ad7 . We could write some tests for it though.

If you want to use it, can use deskfed's 0.4.4 branch or mine master .

seballot commented 3 years ago

Also, in case you need attributes without any value at whole (for exemple in Vue.js <div v-else>), I made a fix, here is the repo : https://github.com/seballot/haml-js

your can add it to your project with npm install seballot/haml-js#master