Monday, 17 April 2017

How to include the content of a CSS file into node EJS template

I'm using express and public folder for loading CSS inside a tag. But I wonder if it is possible to load it as text directly on EJS template, similarly as including another EJS file. I know it is possible to load the css content using fs and sending it to the render function, but I wonder if EJS has a method for including any sort of file. Something similar to:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <% include('../public/css/style.css') %>
</head>
<body>
    <% include('./partial.ejs') %>
</body>
</html>



via Vandervals

No comments:

Post a Comment