EJS, using only with HTML - html

I have already used ejs with my node js projects. What I want to know is, is it possible to use ejs only with html. (without node).

EJS is built in JavaScript. It doesn't require Node.js, just a JavaScript environemtn.
HTML is a markup language... not something you can program in. But, of course you can insert a <script> tag for your JavaScript in HTML, and run EJS and any other JavaScript you want.

Related

Validate angular2 HTML and CSS with Webpack

I have an angular2 project that uses webpack to process all the typescript, html, and css.
I would like to validate my HTML and CSS/SCSS every time it's rebuilt, but I don't see any webpack loaders to do this. Not sure if I'm just searching for the wrong things, but searches like webpack validate html template angular2 aren't returning anything related.
The only way I have to validate the HTML right now is to load the relevant part of the page, copy the rendered source to a string and put it in the w3 validator.
Any suggestions for webpack loaders to validate HTML and CSS/SCSS?

How to inject HTML (a template) and CSS into a JavaScript file?

I would like a JavaScript file which builds and minifies an HTML and CSS file and pulls them as strings, possibly, so that it can all be one minified JS file to be used.
I'm curious what's the best flow for achieving this. I see that with gulp inject, this may work?
Found a solution: gulp-js-text-inject did exactly what I needed here.

How can i transform Jade files into html?

I am starting with Node.js application, so I wanted to take some help from the existing solutions but in views their are always jade files what are they and how can i transform them to html easily?
You can use EJS for templating other then Jade which provide additional features of HTML. You can configure template on app.js of Express
At http://html2jade.org/ you can paste jade templates into the jade side (on the right) and it will convert it to html (on the left).
(N.B. this functionality does not exist on http://html2pug.org/)
To transform Jade code to Html, you have to install jade compiler in your system and then by using jade CLI you can convert your jade file to Html Read here, But if you not want to install it to system convert it online here Jade to Html Converter.

Masterpage concept for plain HTML

I got a realtive big project for what I have many plain HTML pages. All the pages have the same template, but when I change one value in the template I have to change all the other pages manually.
Is there a way to do it like less for CSS or CoffeeScript for JS?
Lg Knerd
If all you have are plain HTML pages you could use SSI although it is a bit dated and youll need to be running this on a web server like Apache.
http://en.wikipedia.org/wiki/Server_Side_Includes
Personally I would use php so I could just include the files with the php include function

How can I import an HTML file within my HTML file?

How can I import an HTML file within my HTML file? I will prepare header.html and footer.html files separately and every file that I want to include them I want to import them into my HTML file.,
EDIT: I see that solution based on SSI technique. I use Ubuntu and Tomcat 7.0.11. How can I enable SSI at tomcat?
There are many solutions to this problem. You can write simple JavaScript code to include parts of your page on load, you can enable SSI on your web-server, and finally you can use any server-side language to dynamically include chunks of any page for output. Your choice depends on how dynamic your web-site is.
You can include html files using frames or iframes. If you're using a server side language such as PHP or ASP you can do this without frames using includes.
If you wanted to strictly use HTML (and assuming you are using JS too) I would do the following:
You could have a <div> for the header, I will call it <div id="header">.
Using jQuery we could say something like: $('#header').load(---html file---);. Aside from the pain it might be to include the JS file in all pages, it will allow you to make changes to the header globally throughout your application.