By default, Laravel contains a gulpfile.js
file that is used by gulp to run its tasks. The file contains a require
method that includes everything needed for the tasks to run:
var elixir = require('laravel-elixir'), /* |---------------------------------------------------------------- | Elixir Asset Management |---------------------------------------------------------------- | | Elixir provides a clean, fluent API for defining some basic gulp tasks | for your Laravel application. By default, we are compiling the Sass | file for our application, as well as publishing vendor resources. | */ elixir(function(mix) { mix.less('app.less'), });
The first mix is shown as an example: app.less
. To run gulp, simply type gulp
at the command line as follows:
$ gulp
The output is shown here:
[21:23:38] Using gulpfile /var/www/laravel.example/gulpfile.js [21:23:38] Starting 'default'... [21:23:38] Starting 'less'... [21:23:38] Running Less: resources/assets/less/app.less [21:23:41] Finished 'default' after 2.35 s [21:23:43] gulp-notify: [Laravel Elixir] Less Compiled! [21:23:43] Finished 'less' after 4.27 s
The first line indicates that the gulp file was loaded. The following lines show each task running. The less
job deals with the cascading style sheet preprocessor Less
.