Vite文件包含插件的设计与实现  被引量:1

The Vite file contains the design and implementation of the plugin

在线阅读下载全文

作  者:张文豪 Zhang Wenhao(Faculty of Big Data and Computing,Guangdong Baiyun University,Guangzhou 510450,China)

机构地区:[1]广东白云学院大数据与计算机学院,广州510450

出  处:《现代计算机》2023年第18期89-92,共4页Modern Computer

摘  要:为了在使用Vite作为前端构建工具时减少重复的网页代码,开发一个基于Vite的文件包含插件是十分必要的。根据Vite的插件机制,利用Vite插件的转译代码钩子函数(transform)对文件代码内容进行文件包含的语法匹配,存在文件包含标签时则加载目标文件内容,然后将加载的内容嵌入到源文件来实现文件包含的功能。实际应用的结果表明,采用该方法可以满足在日常开发中文件包含功能的需求。In order to reduce repetitive webpage code when using Vite as a front-end construction tool,it is necessary to develop a Vite-based file inclusion plugin.According to the plug-in mechanism of Vite,use the translating code hook function(transform)of the Vite plug-in to perform file inclusion syntax matching on the file code content,load the target file content when there is a file inclusion tag,and then embed the loaded content into the source file to achieve The functions contained in the file.The results of practical application show that this method can meet the needs of file inclusion functions in daily development.

关 键 词:VITE TypeScript include-file vite-plugin 

分 类 号:TP393.09[自动化与计算机技术—计算机应用技术]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象