express-compiler-core
v0.0.0-alpha.4
Published
You can use code blow like an example, all packages presented under are examples (express is realy recomanded) so noone is included (if you want them to be already included, see [express-compiler](https://www.npmjs.com/package/express-compiler)
Downloads
2
Readme
You can use code blow like an example, all packages presented under are examples (express is realy recomanded) so noone is included (if you want them to be already included, see express-compiler
require('colors');
const express = require('express'),
less = require('less'),
pug = require('pug'),
links = require('./links.json'),
app = express(),
{
compile,
getLast
} = require('express-compiler-core');
app.use('/', compile({
baseFolder: './Public',
parser: path => getLast(path.split('/')).includes('.') ? path : `/HTML/${ links[path] }.html`,
map: [
{
ext: 'less',
compiler: async str => (await less.render(str)).css
},
{
ext: 'pug',
compiler: pug.render
}
]
}));
app.listen(8080, console.log('Connected !'.america));