Upload resource to cdn for stc
npm install stc-cdn
// stc.config.js
var cdn = require('stc-cdn');
var cdnAdapter = require('stc-cdn-xxx');
stc.workflow({
cdn: {plugin: cdn, options: {adapter: cdnAdapter}}
});
adapter code like this:
export default function stcAdapter(content, filepath, options, cacheInstance){
let value = await cacheInstance.get();
if(value !== undefined){
return value;
}
value = await getCdnUrl(content);
await cacheInstance.set(value);
return value;
}
- stc-cdn-qiniu - 七牛 Adapter