0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VSCodeでSass導入

0
Last updated at Posted at 2026-01-02

1. 適当にCSSを適用するhtmlをChatGPTで作成

idのtestの文字色を青色に変えていく。
※ コメントは私のメモなので気にしないでください。

index.html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="UTF-8" />
    <!-- レスポンシブの対応 -->
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>ページタイトル</title>
    <meta name="description" content="ページの説明" />
    <link rel="stylesheet" href="css/style.css">
  </head>
  <body>
    <header>
      <h1>サイト名</h1>
    </header>

    <!-- タブ操作など -->
    <main>
      <section>
        <h2>見出し</h2>
        <p>コンテンツ</p>
        <div id="test">青色</div>
      </section>
    </main>

    <footer>
      <small>© 2026</small>
    </footer>
  </body>
</html>

スクリーンショット 2026-01-03 13.39.38.png

2. VSCodeでLive Sass Complierの拡張機能をインストール

スクリーンショット 2026-01-03 0.36.55.png

インストール後のVSCode画面下部
スクリーンショット 2026-01-03 0.38.19.png

注意:私の場合、.sassファイルを開いていないと「Watch Sass」は表示されなかった。

css/style.sass
#test 
    color: blue

保存後、作成されるCSS
・css/style.css.map
・css/style.css

css/style.css
#test {
  color: blue;
}/*# sourceMappingURL=style.css.map */

これで、idがtestの箇所は文字色が青くなる。

3. 画面

スクリーンショット 2026-01-03 0.32.25.png

4. 感想

今回は導入まで行った。
私もsassは業務で軽く触ったレベルだが、プログラミングができれば十分対応可能である。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?