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.
Jade is an elegant templating engine, primarily used for server-side templating in NodeJS. In plain words, Jade gives you a powerful new way to write markup, with a number of advantages over plain HTML.
Jade is a template engine for node. js and the default rendering engine for the Express web framework. It is a new, simplified language that compiles into HTML and is extremely useful for web developers. Jade is designed primarily for server-side templating in node.
From jade docs:
doctype html
html
head
style
include style.css
body
h1 My Site
p Welcome to my super lame site.
It works perfect.
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 ?
Pass fs
in as data and you can
style !{fs.readFileSync("index.css").toString()}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With