检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:张文豪 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[自动化与计算机技术—计算机应用技术]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:3.134.86.4