Abe Miessler
Abe Miessler

Reputation: 85056

Possible to inline an entire linked css file using Jade?

Google's PageSpeed insights is recommending that I stop using links to pull in CSS files and instead directly include the styles under a style tag. Is there any way in Jade to specify a CSS file and have it's contents pulled into my HTML file when I compile?

Upvotes: 1

Views: 453

Answers (1)

saintedlama
saintedlama

Reputation: 6898

You can include plain text in jade. See Jade Language Reference.

To include a CSS file in jade add a style element to your jade file and use the include with the css extension. Jade will figure out by extension if the file should be interpreted as plain text or as jade file.

doctype html
html
  head
    title= title

    style
      include stylesheet.css

  body
    block content

The awesome thing about this method is that you do not have to modify your existing stylesheet file.

Upvotes: 2

Related Questions