'Minify my css file in laravel [closed]
Is there any tool that helps me in organizing my css files.I have so many css files in my app and i have to include them one by one like {!! Html::script('assets/css/bootstrap.min.css')!!}
and others so that the load time of the app won't also take long. thanks
Solution 1:[1]
Laravel Elixir
Here is the official documentation and complete guide how can you minify css as well as js files in your application. https://laravel.com/docs/5.2/elixir
Solution 2:[2]
In laravel, you get a default app.css
it contains bootstrap css and some others also. They are in minimized form.
If you are using laravel 5.4 you can enter css in sass format in /resources/assets/sass/
and register it in webpack.mix.js
file.
Then by running npm run production
you get all the files in minimized form. Which reduce the size and increase security.
You can also create all the css files in one single file to reduce effort to insert all.
If you are using laravel 5.3 or below then you can use gulp
to minimize the files.
Solution 3:[3]
You can use this command to "compile" files to production mode and minify any CSS/JS:
npm run production
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Community |
Solution 2 | |
Solution 3 | Skatox |