Search code examples
node.jspug

How to include a css file in jade (without linking it)


I have this jade file:

!!! 5
html
  head
    title test include
    style(type='text/css')
      //- DOES NOT WORK!
      include test.css
  body
    //- works
    include test.css
    div 
      //- works
      include test.css

The output:

$ jade -P test.jade 
rendered test.html
$ cat test.html
<!DOCTYPE html>
<html>
  <head>
    <title>test include</title>
    <style type="text/css">
      //- DOES NOT WORK!
      include test.css
    </style>
  </head>
  <body>body { color: peachpuff; }

    <div> body { color: peachpuff; }

    </div>
  </body>
</html>

Of course, I could simply link the css-file, but I do not want to.


Solution

  • I didn't test it yet (not on my dev computer ATM) but there is a chance doing something like this could work :

    !!!
    head
      title test include
      | <style type='text/css'>
      include test.css
      | </style>
    

    By the way, I found the HTML2Jade online converter but not the Jade2HTML. Any idea where to find it ?