This style code worked for me a few months back. I have updated to the latest Jade NPM package and now it is not working. Can some please assist me with the proper way to inline a style in a Jade template?
doctype 5
html(lang="en")
head
style(type='text/css')
.ui-title {
margin: 0.6em 10% 0.8em !important;
}
I get this error on the closing }
unexpected text }
Try Pug HTML without Installing Simply create a new pen, then select Settings > HTML and choose Pug as your preprocessor. This will allow you to enter Pug code into the HTML pane and see the result appear in real time.
Jade is a template engine for Node.js. Jade syntax is easy to learn. It uses whitespace and indentation as a part of the syntax.
Express.js can be used with any template engine. Here, we will use different Jade templates to create HTML pages dynamically. In order to use Jade with Express.js, create sample.jade file inside views folder and write following Jade template in it.
The main advantage of Jade is that this text renders both closing and opening tags for the HTML element, as well as the <></> symbols. Therefore, we save many keystrokes as developers writing in Jade! The text following a tag and a space (e.g., tag <text>) is parsed as the inner HTML (i.e., content inside the element).
If you want to try this out as we go along, you can use CodePen and choose Jade as your HTML preprocessor or use the online compiler on the official Jade page to compile your Jade to HTML. As you might have noticed earlier, there are no “closing” tags in Jade.
This worked for me:
style.
body {
background-color: {{themeColor}};
}
Got it from: https://github.com/mquandalle/meteor-jade/issues/102 where the post suggests to use "dot notation"
There are three ways of putting text inside your tags in Jade
h1 Some header text
And the output will be:
<h1>Some header text</h1>
|
e.g.p
| Some text goes
| here
And the output will be:
<p>Some text goes here</p>
|
) e.g.p.
This way 3rd way of putting
text inside
And the output will be:
<p>This way 3rd way of putting text inside</p>
So based on the above, the approach you chose (as in your comment) is correct (option 3).
doctype 5
html(lang="en")
head
style(type='text/css').
.ui-title {
margin: 0.6em 10% 0.8em !important;
}
I hope that will help.
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