Change sails.js EJS views to use .html extensions instead of .ejs extensions?

2024/2/27 9:01:15

Is it possible to configure sails.js apps to use .html extentions rather than .ejs (but still use the ejs view engine)?

sails new app creates ./views/home/index.ejs and ./views/layout.ejs.

I'd like to change the extensions to .html but keep everything else working the same way.

ie: I would now have ./views/home/index.html and ./views/layout.html, and the home page would still be injected into the layout page, as per normal.

How can I configure this please?


In your config/views.js:

engine: {ext: 'html',fn: require('ejs').renderFile

Seems though that the future support for this feature is not guaranteed, since they removed this from docs, so use with caution.

Related Q&A

How to select text with jQuery

How can I select a part of the text and process by jQuery? For example, I have a text as<div id="test">This is an example text here</div>I select few words (not the whole div) wi…

jquery Using ranges in switch cases?

Switch cases are usually like Monday: Tuesday: Wednesday: etc. I would like to use ranges. from 1-12: from 13-19: from 20-21: from 22-30:Is it possible? Im using javascript/jquery by the way.

How to download a recording using getUsermedia and mediaRecorder and give the video specifications?

navigator.mediaDevices.getUserMedia().then(stream=>{//a recorder is created var mediaRecorder = new MediaRecorder(stream);//started it mediaRecorder.start();//an array is created that receives all t…

Crockfords hanoi function (from The Good Parts) [duplicate]

This question already has answers here:How does recursive algorithm work for Towers of Hanoi?(2 answers)Closed 9 years ago.At the moment Im reading Douglas Crockfords book, and the towers of hanoi fun…

How to import multiple svgs in vue.js via vue-svg-loader

I want to import multiple svgs in one vue component. The documentation says I Have to import each one of them, but how can I import multiple svgs in a much shorter and cleaner way?vue-svg-loader docum…

Detecting Screen Resolution to load alternative CSS a good idea?

Im working with a graphic designer who constantly wants to make websites larger than the 960 pixels i recommend. I can do a certain amount with liquid layouts but id really love to be able to load diff…

Backbone.js events in my views being triggering multiple times

I may have a misunderstanding on how to implement backbone.js, because all of my views that support multiple models (for example, a "Product" view that that can display multiple products), wi…

localstorage and setInterval() with multiple tabs

We have some data stored in localstorage and we are using window.setInterval() to regularly update it every minute. In this interval we are continuously reading and writing the data.Is it possible that…

Is there any way to load css and javascript from a string?

Ive seen many examples of loading CSS and javascript dynamically from a file. Heres a good example. But is there a way to load CSS or javascript as a string? For example, something like:var style =…

Jquery Dialog, Adding a new line of styled text

I am trying to create a customer support dialog. I want the dialog to have two lines of text, and a title. The first line will be an error message, and the second will be a bold customer service number…