Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional comments support #30

Open
xsuii opened this issue Apr 19, 2014 · 4 comments
Open

Conditional comments support #30

xsuii opened this issue Apr 19, 2014 · 4 comments

Comments

@xsuii
Copy link

xsuii commented Apr 19, 2014

I would like to use the conditional comments feature by using grunt-haml. But got some error.
This is my grunt task configuration:

{
    haml: {
        files: {
            expand: true,
            cwd: 'app',
            dest: '.tmp',
            src: '{,*/}*.haml',
            ext: '.html'
        }
    }
}

and this is my .haml code:

!!! 5
/[if IE]
  %html(class="no-js lt-ie9 lt-ie8 lt-ie7")

The error:

Running "haml:files" (haml) task
with(locals || {}) {
  try {
   var _$output="<!DOCTYPE html>\n"
"<!--adfdf\n\n%html(class="no-js lt-ie9 lt-ie8 lt-ie7")-->";
 return _$output;  } catch (e) {
    return "\n<pre class='error'>" + html_escape(e.stack) + "</pre>\n";
  }
}
>> SyntaxError: Unexpected identifier
Warning: Haml failed to compile. Use --force to continue.

Aborted due to warnings.
@taystack
Copy link

What you are looking for is:

%haml.no-js.lt-ie9.lt-ie8.lt-ie7

Your notation is almost there, but why waste the time with all the characters when haml is meant to make your life easier.

%haml(class: 'class1 class2')

Both will work, but which one looks better? Don't forget the colon for assignment!

@xsuii
Copy link
Author

xsuii commented Apr 19, 2014

@taystack Ok, it is a little mistake here, thanks for your reminding. But my point is the support of conditional comments feature which means the compiling of

/[if IE]
    %html

doesn't work well.

@taystack
Copy link

@xsuii Understood. I figured we could address the error message and take it from there. Happy coding!

@xsuii
Copy link
Author

xsuii commented Apr 19, 2014

@taystack Appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants