Search code examples
htmlcsspugfont-awesomestylus

Unable to compile pug program


I'm trying to compile my pug program but receiving an error. This is the error I'm getting: C:\npm\node_modules\pug-cli\node_modules\acorn-globals\node_modules\acorn\dist\acorn.js:2490 throw err ^

SyntaxError: Unexpected token (3:0)

-var sites = [
-  'facebook',
-  'twitter',
-  'google',
-  'instagram',
-  'dribbble',
-  'codepen',
-  'skype'
-]

.social-btns
  each site in sites
    a(href='#', class='btn ' + site)
      i(class='fa fa-' + site)

Solution

  • I would recommend using the indented block-style dash. This minimizes the chance of syntax errors and lets you write uninterrupted JavaScript.

    - 
      var sites = [
        'twitter', 
        'facebook', 
        'google', 
        'instagram', 
        'dribbble', 
        'codepen', 
        'skype'
      ];
    
    .social-btns
      each site in sites
        a(href='#', class='btn ' + site)
          i(class='fa fa-' + site)