@ architect/ asap (英语)
建筑师静态资产代理(ASAP) - 基于Lambda的静态资产交付的有帮助的图书馆
使用量
模块
手动调用您的处理器功能中的 ASAP :
let asap = require('@architect/asap')
// All config is optional!
module.exports = asap({
// Alias assets to different filenames
alias: {
'/an-asset.jpg': '/a-different-filename.jpg',
'/a-path': '/a-different-path',
},
// Pass your own fingerprinted static asset manifest (defaults to Arc-generated static.json)
assets: { 'some-file.gif': 'some-file-a1b2c3.gif' },
// Set a custom bucket configuration (defaults to Arc-generated buckets)
bucket: {
staging: 'staging-bucket-name',
production: 'production-bucket-name',
folder: 'some-bucket-subfolder',
},
// Override the content-aware cache-control header
cacheControl: 'max-age=0',
// Manually set response headers
headers: { 'some-header': 'ok=true' },
// Return null if asset is not found (defaults to `false`)
passthru: true,
// Engage SPA mode (defaults to `false`)
spa: false,
})
羊田处理器
尽快用你的羊陀螺管! 如果你使用建筑师,这是自动完成的 当你不定义根处理器 @http 破烂.
如果使用 ASAP 非Architect 工程, 请将您的 Lambda 源目录指向 src/,并且确保设置以下两个外壳:
ARC_ENV数字 :staging或者说productionARC_STATIC_BUCKET: 存储您的资产的 S3 桶名