29.07.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Laravel Elixir 227<br />

.<br />

1 // Run all tasks...<br />

2 gulp<br />

3<br />

4 // Run all tasks and minify all CSS and JavaScript...<br />

5 gulp --production<br />

Watching Assets For Changes<br />

Since it is inconvenient to run the gulp command on your terminal after every change to your assets,<br />

you may use the gulp watch command. This command will continue running in your terminal and<br />

watch your assets for any changes. When changes occur, new files will automatically be compiled:<br />

.<br />

1 gulp watch<br />

Working With Stylesheets<br />

The gulpfile.js file in your project’s root directory contains all of your Elixir tasks. Elixir tasks<br />

can be chained together to define exactly how your assets should be compiled.<br />

Less<br />

To compile Less¹⁴³ into CSS, you may use the less method. The less method assumes that your<br />

Less files are stored in resources/assets/less. By default, the task will place the compiled CSS for<br />

this example in public/css/app.css:<br />

1 elixir(function(mix) {<br />

2 A> mix.less('app.less');<br />

3<br />

4 });<br />

You may also combine multiple Less files into a single CSS file. Again, the resulting CSS will be<br />

placed in public/css/app.css:<br />

¹⁴³http://lesscss.org/

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!