Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add support for interpolation

オープン
#1,460 コメント 4 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
css, typescript
領域
frontend

調査の方向性

まず、CSS オブジェクトプロパティに対する補間が現在どのように処理されているか、また css テンプレートリテラルがどのように処理されているかを追跡します。オブジェクトを css リテラルに補間する際の期待される動作を確認し、その後、生成されたボタンのスタイルに、リテラルの宣言とともに補間されたフォントプロパティが含まれることを示すテストカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

説明

enhancement: proposal 💬 needs: triage 🏷

Why is interpolation only supported for CSS object properties and not for css literals?

import { css } from '@linaria/core';

// REQUIRED:

const fontMedium = {
  fontSize: '24px',
  fontWeight: 'bold'
}

// WANTED:

// const fontMedium = css`
//   font-size: 24px;
//   font-weight: bold;
// `

const button = css`
  ${fontMedium}
  
  color: #862e9c;
  border: 1px solid;
  border-radius: 4px;
  padding: 0.5rem 1rem;

  &:hover,
  &:focus {
    color: #be4bdb;
  }
`;

export const Button = (props) => {
  return <button {...props} className={button} />;
};

Why do we need to use two completely different syntaxes to interpolate CSS properties?

I would very much like to stick with one syntax.

Using multiple classes is not really a great option for something like typographies either - I'd very much like to have the button declaration include the typography, and manually reusing the 5-10 properties required for a complete typography is not really a good option either.

Using multiple classes works (cx) but is not a great option either - I would very much prefer if the button styles were self-contained, residing in a single declaration, not spread between two classes.

Is there a reason this isn't practical or can't be done?

主要言語
TypeScript
スター
12.4k
フォーク
413
平均マージ
3日 4時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

callstack/linaria のほかの issue

callstack/linaria の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。