Search code examples
htmlpug

Converting the HTML part of the current Facebook button into the Jade Template Language?


This is the code for the Facebook like button:

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=101562769948573";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="http://foodjing.com/" data-send="true" data-width="450" data-show-faces="true"></div>

I would like to write that in Jade (because my index is a jade file). How do I accomplish that?


Solution

  • Look into jade documentation .https://github.com/visionmedia/jade

    I would suggest you the following:

    div#fb-root
    script
    (function(d, s, id) {
       var js, fjs = d.getElementsByTagName(s)[0];
       if (d.getElementById(id)) {return;}
       js = d.createElement(s); js.id = id;
       js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=101562769948573";
       fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    
    div.fb-like(data-href="http://foodjing.com/" data-send="true" data-width="450" data-show-faces="true")