Skip to content

stcjs/stc-cdn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stc-cdn

Upload resource to cdn for stc

Install

npm install stc-cdn

How to use

// stc.config.js

var cdn = require('stc-cdn');
var cdnAdapter = require('stc-cdn-xxx');

stc.workflow({
  cdn: {plugin: cdn, options: {adapter: cdnAdapter}}
});

Adapter introduction

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;
}

Adapter list

About

Upload resource to cdn for stc

Resources

License

Stars

Watchers

Forks

Packages

No packages published