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?

More than 3 years have passed since last update.

Laravel Mix コンパイル時のOS通知を無効にするには

Last updated at Posted at 2021-07-04

Laravelでアプリ開発していると、必ずといっていいほど、Laravel Mixにお世話になります。この Laravel Mix というのは、resources フォルダに入っているCSSとJavaScriptをコンパイルして圧縮しちゃう便利なパッケージです。

今回は、npm run dev とコマンドで打ってLaravel Mix 実行後のOS通知を無効化する便利な書き方があったのでご紹介。

普通のwebpack.mix.js
mix.js('resources/js/app.js', 'public/js').postCss('resources/css/app.css', 'public/css', [
    require('postcss-import'),
    require('tailwindcss'),
    require('autoprefixer'),
]);

だいたい、素のLaravelとBreezeをインストールした後だと、↑のようになっていると思います。disableNotifications メソッドを加えることで Laravel MIX のOS通知を無効化することが可能です。

通知を無効化するwebpack.mix.js
mix.js('resources/js/app.js', 'public/js').postCss('resources/css/app.css', 'public/css', [
    require('postcss-import'),
    require('tailwindcss'),
    require('autoprefixer'),
]).disableNotifications(); // 追加したメソッド

この様に disableNotifications メソッドを加えることで、通知の有無を制御することが可能になります。run dev watch などを利用して、頻繁にコンパイル作業をするかたは、是非使ってみると良いメソッドだと思います。

参考:https://readouble.com/laravel/8.x/ja/mix.html

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?