Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG 크기 설정을 위한 next.config.js 수정 #403

Merged
merged 2 commits into from
Sep 16, 2023

Conversation

eunsukimme
Copy link
Member

@eunsukimme eunsukimme commented Sep 16, 2023

📋 작업 내용

  • SVG 컴포넌트 크기 설정이 안돼서 설정 가능하도록 next.config.js 설정을 수정했어요. icon.svg?v2 라는 쿼리 스트링을 import 할때 붙이면 해당 파일을 import 할때는 webpack이 svgo를 사용하도록 하고, viewBox 옵션을 제거하지 않도록 했어요(svgo의 default 동작은 viewBox를 제거해요)

📌 PR Point

이렇게 해서 크기를 수정할 수 있어요

Inline Attributes

import CheckedIconV2 from '@assets/svg/icon_progress_checked.svg?v2';
const Foo = () => <CheckedIconV2 width={24} height={24} />;

CSS

import CheckedIconV2 from '@assets/svg/icon_progress_checked.svg?v2';

const ScalableCheckedIconV2 = styled(CheckedIconV2, {
  width: '24px',
  height: '24px',
});

const Foo = () => <ScalableCheckedIconV2 />;

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 16, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: e9b1c7c
Status: ✅  Deploy successful!
Preview URL: https://8ef6b044.sopt-crew-dev-legacy.pages.dev
Branch Preview URL: https://svgr-svgo-config.sopt-crew-dev-legacy.pages.dev

View logs

@eunsukimme eunsukimme temporarily deployed to development September 16, 2023 11:53 — with GitHub Actions Inactive
@eunsukimme eunsukimme marked this pull request as ready for review September 16, 2023 11:57
Copy link
Contributor

@na-reum na-reum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋아요~

Copy link
Member

@100Gyeon 100Gyeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

은수 오빠 덕분에 항상 SVG 편하게 쓰는구만 굿굿 🚀

@eunsukimme eunsukimme merged commit af09758 into develop Sep 16, 2023
4 checks passed
@eunsukimme eunsukimme deleted the svgr-svgo-config branch September 16, 2023 15:32
@borimong
Copy link
Contributor

늦게 확인 완료했습니담🥲

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants