You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
settings.logger.log(`[action-fonts] Uninstalling font ${fontdest}...`);
82
+
83
+
if(fs.existsSync(fontdest)){
84
+
fs.unlinkSync(fontdest);
85
+
}
86
+
}
87
+
59
88
module.exports=async(job,settings,params,type)=>{
60
-
if(type!="prerender"){
89
+
if(type!="prerender"&&type!="postrender"){
61
90
thrownewError(
62
-
`Action ${name} can be only run in prerender mode, you provided: ${type}.`,
91
+
`Action ${name} can be only run in prerender or postrender mode, you provided: ${type}.`,
63
92
);
64
93
}
65
94
66
-
letfontsAdded=0;
67
-
68
-
/* iterate over assets, and install all assets which are fonts */
69
-
for(constassetofjob.assets){
70
-
if(asset.type!=="static"){
71
-
continue;
72
-
}
73
-
74
-
if(!asset.src.match(/\.(ttf)$/)){
75
-
continue;
95
+
/* add this action to postrender if it's not already there, to clean up the fonts after the render */
96
+
if(type=="prerender"){
97
+
job.actions.postrender.push({
98
+
module: __filename,
99
+
});
100
+
101
+
letfontsAdded=0;
102
+
103
+
/* iterate over assets, and install all assets which are fonts */
104
+
for(constassetofjob.assets){
105
+
if(asset.type!=="static"){
106
+
continue;
107
+
}
108
+
109
+
if(!asset.src.match(/\.(ttf)$/)){
110
+
continue;
111
+
}
112
+
113
+
if(!asset.name){
114
+
thrownewError(`Asset ${asset.src} has to be named using the "name" property that would contain the font name as it is used to be then used in the After Effets project.`);
thrownewError(`Platform ${process.platform} is not supported.`);
123
+
}
76
124
}
77
125
78
-
if(!asset.name){
79
-
thrownewError(`Asset ${asset.src} has to be named using the "name" property that would contain the font name as it is used to be then used in the After Effets project.`);
0 commit comments