Search code examples
laravelsasslessgulplaravel-elixir

Use SASS instead of LESS in new Laravel 5 project


How can I use SASS instead of LESS in a new Laravel 5 installation?

A couple of weeks ago SASS was the chosen pre-processor but since then, Taylor has changed Laravel to use LESS out the box. Laravel Elixir / Gulp still has support for compiling SASS but I am not sure how to get the SASS files into my project in the first place.

If anyone has any ideas of the steps, please holla.


Solution

  • More example how to

    elixir(function(mix) {
       mix.sass("app.scss");
    });
    

    By default, larvel 5 store all assets in vendor/bower_components

    And if you want use for example angular.js, which stored in vendor/bower_components/angular/angular.js

    You publish them to your public folder.

     elixir(function(mix) {
           mix.sass("app.scss").
                    publish('angular/angular.js', 'public/js/angular/angular.js';
     });
    

    I think, the same logic will work and for sass files.

    Or, you can try, via

    var paths = {
        'bootstrap': './vendor/bower_components/bootstrap-sass-official/assets/'
    }
    
    elixir(function(mix) {
        mix.sass("style.scss", 'public/css/', {includePaths: [paths.bootstrap + 'stylesheets/']})
    });