Skip to content

qyjandroid/lottie-extract-assets-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lottie-extract-assets-plugin

Lottie图片资源提取,生成js文件 配置文件:

[
    "https://xxx/ceremonyBlessingBagFirst/data.json"
]

生成格式如下:

window._config = [
    {
        "key": "ceremonyBlessingBagFirst",
        "url": "https://xxx/ceremonyBlessingBagFirst/data.json"
    },
    {
        "key": "ceremonyBlessingBagFirst_img_0.png",
        "url": "https://xxx/ceremonyBlessingBagFirst/images/img_0.png",
        "source": "https://xxx/ceremonyBlessingBagFirst/data.json",
        "lottieName": "ceremonyBlessingBagFirst"
    },
    {
        "key": "ceremonyBlessingBagFirst_img_1.png",
        "url": "https://xxx/ceremonyBlessingBagFirst/images/img_1.png",
        "source": "https://xxx/ceremonyBlessingBagFirst/data.json",
        "lottieName": "ceremonyBlessingBagFirst"
    },
    {
        "key": "ceremonyBlessingBagFirst_img_2.png",
        "url": "https://xxx/ceremonyBlessingBagFirst/images/img_2.png",
        "source": "https://xxx/ceremonyBlessingBagFirst/data.json",
        "lottieName": "ceremonyBlessingBagFirst"
    },
    {
        "key": "ceremonyBlessingBagFirst_img_3.png",
        "url": "https://xxx/ceremonyBlessingBagFirst/images/img_3.png",
        "source": "https://xxx/ceremonyBlessingBagFirst/data.json",
        "lottieName": "ceremonyBlessingBagFirst"
    }
];

插件配置:

//to 为相对outPath的相对路径
const to=path.join("lottie", "test");
//configPath 需要提取的lottie配置文件路径
//outFileName 提取的资源保存文件名(使用.js保存)
//to 提取的资源保存路径  (相对于output)
//globalName  提取的资源访问全局对象名称
new LottieExtractAssetsPlugin({configPath:"./lottieConfig.json",to:to,outFileName:"lottie-assets.js",globalName:"window._config"})

About

Lottie图片资源提取,生成json文件

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published