如何运行 JavaScript

问题描述

我有一个可用的 Gulp 脚本,用于创建 SVG 精灵和预览页面。但现在我想丰富预览页面,更准确地说是其中的每个图标,以及我在单独的 json 文件中的信息。但我不知道该怎么做。

它应该看起来像这样:

function taskFactory(name,spriteMode) {
    return gulp.src(srcSvgDir + '*.svg')
        .pipe(svgSprite(config))
        .pipe(jeditor((json) => {
                
    // read json file for this sprite
    // iterate entries in json
    // Find the location in preview page (by selector or placeholder string) and paste the information from the json entry. 

    }))
    .pipe(gulp.dest(destDir));
}

但我不知道我是否可以访问正在创建的这个预览页面。如果有人有完全不同的想法,我愿意接受任何事情。

在紧急情况下,我可以编写一个 C# 控制台应用程序,在创建精灵和预览页面后,解析和编辑后一个文件。不过我觉得这不太好,因为我想纯粹用 Gulp 创建它。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)