css-in-js가 번들되는 과정

1. 코드 파싱

2. 변환

3. 정적 분석 및 최적화

4. JavaScript 번들 생성

5. 런타임 코드 주입

6. 최종 번들 생성 -> 브라우저에서 실행

7. 동적 스타일 처리

// 이 코드는 JavaScript 번들의 일부
const styles = {
  button: {
    backgroundColor: 'blue',
    color: 'white'
  }
};

// 런타임에 실행되는 함수
function injectStyles() {
  const styleElement = document.createElement('style');
  styleElement.textContent = `
    .my-button {
      background-color: ${styles.button.backgroundColor};
      color: ${styles.button.color};
    }
  `;
  document.head.appendChild(styleElement);
}

// 페이지 로드 시 스타일 주입
window.addEventListener('load', injectStyles);