Thanks to visit codestin.com
Credit goes to github.com

Skip to content

KathiaNeira/example-api-pug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Api-pug

var pug = require('pug');
var fs = require('fs');
var glob = require("glob");
var pattern = __dirname + "/frontend/pug/*.pug";
var src = __dirname + "/src/html/";

var filesInput = glob.sync(pattern);

// Compile the source code
filesInput.forEach(function(element, index) {
    var path = element.split("/").pop();
    var name = path.replace('pug', 'html');

    var compiledFunction = pug.compileFile(element, {
      filename : 'pug',
      doctype: 'html',
      pretty: true,
      inlineRuntimeFunctions: true
    });

    var html = compiledFunction();
    fs.writeFileSync(src.concat(name), html, 'utf-8');
});

package.json

"scripts": {
    "pug": "node ./pugDemo.js",
    "watch": "pug -w ./frontend/pug/*.pug --pretty --out  './src/html'"
 },

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors