Help us understand the problem. What is going on with this article?

LaravelにSCSSの導入方法

### 前提
* Laravelのプロジェクトは作られている
* Laravelのバージョンは6.2を使用している

手順

  1. Laravelプロジェクト配下でnpm installのコマンドを実行する

  2. sassメソッドでSassをCSSへコンパイルします

    • プロジェクト配下のwebpack.mix.jsに確認をする
webpack.mix.js
mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');

この一行でwebpackがresources/sass/app.scssファイルをpublic/css/app.cssにコンパイルしてくれる

3.npm run devでコンパイルする。

  • npm run watchコマンドだと、app.scssファイルに変更が加わると自動でコンパイルしてくれるから便利!

4.app.cssを読み込む

<link href="{{ asset('/css/app.css') }}" rel="stylesheet">

app.cssが読み込まれる

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした