A collection of programming & webdesign
Use of npm in Laravel to manage CSS

For your CSS in Laravel you can either use the public folder or use the resources/css folder and npm to manage and compile your CSS.

For this, do the following:

  • make sure you have node (with npm) installed and that you also used the command  npm install  to install it right within your Laravel project folder
  • open your IDE and Laravel project, navigate in the project structure down to the file webpackmix.js and see if you have to correct the paths to your resources/css files
  • to compile your CSS, use this command in the terminal:  npm run dev 

After you did this you should see a duplicate version of your CSS-file in the public folder of your project, created by npm. To make changes to your CSS use the files in the resources/css folder, and don't forget to compile after each change, otherwise your changes won't show up.