Änderungen admin
This commit is contained in:
35
test/node_modules/startbootstrap-sb-admin/scripts/render-pug.js
generated
vendored
Normal file
35
test/node_modules/startbootstrap-sb-admin/scripts/render-pug.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const upath = require('upath');
|
||||
const pug = require('pug');
|
||||
const sh = require('shelljs');
|
||||
const prettier = require('prettier');
|
||||
|
||||
module.exports = function renderPug(filePath) {
|
||||
const destPath = filePath.replace(/src\/pug\/\pages/, 'dist').replace(/\.pug$/, '.html');
|
||||
const srcPath = upath.resolve(upath.dirname(__filename), '../src');
|
||||
|
||||
console.log(`### INFO: Rendering ${filePath} to ${destPath}`);
|
||||
const html = pug.renderFile(filePath, {
|
||||
doctype: 'html',
|
||||
filename: filePath,
|
||||
basedir: srcPath
|
||||
});
|
||||
|
||||
const destPathDirname = upath.dirname(destPath);
|
||||
if (!sh.test('-e', destPathDirname)) {
|
||||
sh.mkdir('-p', destPathDirname);
|
||||
}
|
||||
|
||||
const prettified = prettier.format(html, {
|
||||
printWidth: 1000,
|
||||
tabWidth: 4,
|
||||
singleQuote: true,
|
||||
proseWrap: 'preserve',
|
||||
endOfLine: 'lf',
|
||||
parser: 'html',
|
||||
htmlWhitespaceSensitivity: 'ignore'
|
||||
});
|
||||
|
||||
fs.writeFileSync(destPath, prettified);
|
||||
};
|
Reference in New Issue
Block a user