Can you express the html mix and jade routes?

I want to set up an application where I can write as much html on jade as possible. I do not like jade, I just want to write the html / angular / node API, since I am studying several technologies at once (angular, node, jade, etc.).

I would like to build a skeleton project as follows:

  • Static (server pages using jade or html) for SEO (main business card pages). i.e. sitename.com/about, sitename.com/

  • angular managed administration area (i.e. sitename.com/admin), i.e. one html file with built-in angular views / particles.

Should I just study jade or try to use this mixed approach? I have the first part (simple static jade pages).

+4
source share
2 answers

Express is pretty template-agnostic, as you can choose any template engine that you like. If you want more HTML-style templates, you can use ejs instead of Jade, for example:

// install ejs first npm install ejs 
 // app.js var express = require('express'); var app = express(); app.engine('html', require('ejs').renderFile); app.set('view engine', 'html'); app.get('/', function(req, res) { res.render('index', { name : 'World' }); }); app.listen(3012); 
 // ./views/index.html <h1>Hello <%= name %>!</h1> 
 // Output: <h1>Hello World!</h1> 
+7
source

You can include html files in jade (now pug). Just write include path-to-file

+1
source

Source: https://habr.com/ru/post/1484219/


All Articles