首页 > 其他分享 >模板配置-模板根目录及后缀配置

模板配置-模板根目录及后缀配置

时间:2022-09-23 17:25:07浏览次数:39  
标签:const 配置 html template path 根目录 模板

const template = require('art-template');
const path = require('path');
// 时间
const sd = require('silly-datetime');

//设置模板根目录
template.defaults.root = path.join(__dirname, 'views');
// 设置模板根目录
template.defaults.extname = '.html'
// 向模板中导入变量,以便在模板中使用
template.defaults.imports.sd = sd;

const html = template('06.art',{
     time: new Date()
});
console.log(template('07',{}));
console.log(html);

 

标签:const,配置,html,template,path,根目录,模板
From: https://www.cnblogs.com/wangxianwen/p/16723444.html

相关文章

  • vue3路由简单配置
    路由目录各文件内容【router/index】import{createRouter,createWebHashHistory,createWebHistory}from"vue-router";import{scrollBehavior}from"./helpe......
  • centos部署Django三:编写相关配置文件及启动服务
     1.进入到项目的根目录,编写uwsgi.xml配置文件*:centos用的不是uwsgi.ini,而是uwsgi.xml<uwsgi><socket>127.0.0.1:8997</socket><!--内部端口,自定义......
  • vue3配置全局过滤器
    vue3配置全局过滤器需要在main.js中配置一下代码//vue3配置全局过滤器app.config.globalProperties.$filters={//formatTime过滤器的名称formatTime(value:s......
  • 二分模板
    intsearch(vector<int>&nums,inttarget){intleft=0,right=nums.size();intmid;while(left<right){mid=(left+right)>>1;......
  • Linux安装nacos并配置开机启动
    一、Nacos的安装、启动1、解压tar-zxvfnacos-server-1.4.1.tar.gz-C/usr/local注意:nacos的启动需要java的jdk环境支持才能成功运行。启动、开机自启3.启动和关闭......
  • java使用ClassLoader加载配置文件(properties)
    importjava.io.File;importjava.io.FileInputStream;importjava.io.FileNotFoundException;importjava.io.InputStream;importjava.util.Properties;publiccl......
  • 实验环境安装配置
    实验环境安装配置一、实验目的熟悉实验环境熟悉Linux基本操作二、实验要求(一)任务请根据实验环境安装文档,完成特定开源软件的安装......
  • Visual Studio发布到IIS及Web Deploy配置部署
    1、官方教程https://learn.microsoft.com/zh-cn/visualstudio/deployment/tutorial-import-publish-settings-iis?view=vs-20222、错误排查如果是请求不通,请检测IP端口......
  • S32K148-lptmr配置
    S32K148自带的定时器,配置非常简单,有时候我会用它做任务周期,配置一个1ms定时器中断一次  初始化函数:voidLPTMR_init(void){LPTMR_DRV_Init(INST_LPTMR1,&lpT......
  • shopify Canopy主题模板配置修改
    Canopy是一个新颖的、可定制的多功能shopify主题,灵感来自Amazon,包括很酷的设置选项,如mega菜单,CanopyShopify主题迎合了挑剔的店主,无论库存大小。shopifyCanopy主题模板......