feat: 이미지 최적화 2·3차(imageAutoSizes/imageSizesPreset) 및 문서/플랜 반영 (TDD)
- ExportOptions.imageAutoSizes 추가 및 기본 sizes 자동 적용 - ExportOptions.imageSizesPreset 추가(mobile-first/desktop-fixed) - 우선순위: imageSizes > preset > auto > none - 테스트 케이스 확장(image.responsive.options.test.ts) - README/MAIN_PLAN 업데이트
This commit is contained in:
+11
-1
@@ -12,6 +12,8 @@ export type ExportOptions = {
|
||||
imageFetchPriority?: 'high' | 'low'
|
||||
imageSrcset?: string
|
||||
imageSizes?: string
|
||||
imageAutoSizes?: boolean
|
||||
imageSizesPreset?: 'mobile-first' | 'desktop-fixed'
|
||||
}
|
||||
|
||||
function renderFaq(section: { props: { items: Array<{ q: string; a: string }> } }) {
|
||||
@@ -130,7 +132,15 @@ function renderHero(section: { props: { heading: string; subheading?: string; im
|
||||
const decoding = opts?.imageDecoding ?? 'async'
|
||||
const fetchpriority = opts?.imageFetchPriority ? ` fetchpriority="${escapeHtml(opts.imageFetchPriority)}"` : ''
|
||||
const srcset = opts?.imageSrcset ? ` srcset="${escapeHtml(opts.imageSrcset)}"` : ''
|
||||
const sizes = opts?.imageSizes ? ` sizes="${escapeHtml(opts.imageSizes)}"` : ''
|
||||
const defaultSizes = '(max-width: 640px) 100vw, 600px'
|
||||
const presetSizes = (() => {
|
||||
if (!opts?.imageSizesPreset) return ''
|
||||
if (opts.imageSizesPreset === 'mobile-first') return '(max-width: 640px) 100vw, 800px'
|
||||
if (opts.imageSizesPreset === 'desktop-fixed') return '1200px'
|
||||
return ''
|
||||
})()
|
||||
const sizesValue = opts?.imageSizes ?? (presetSizes || (opts?.imageSrcset && opts?.imageAutoSizes ? defaultSizes : ''))
|
||||
const sizes = sizesValue ? ` sizes="${escapeHtml(sizesValue)}"` : ''
|
||||
return `
|
||||
<section class="hero" aria-labelledby="hero-heading">
|
||||
<div class="container">
|
||||
|
||||
Reference in New Issue
Block a user