29.07.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Laravel Elixir 226<br />

.<br />

1 node -v<br />

By default, Laravel Homestead includes everything you need; however, if you aren’t using Vagrant,<br />

then you can easily install Node by visiting their download page¹⁴⁰.<br />

Gulp<br />

Next, you’ll want to pull in Gulp¹⁴¹ as a global NPM package:<br />

.<br />

1 npm install --global gulp<br />

Laravel Elixir<br />

The only remaining step is to install Elixir! Within a fresh installation of Laravel, you’ll find a<br />

package.json file in the root. Think of this like your composer.json file, except it defines Node<br />

dependencies instead of PHP. You may install the dependencies it references by running:<br />

.<br />

1 npm install<br />

If you are developing on a Windows system, you may need to run the npm install command with<br />

the --no-bin-links switch enabled:<br />

.<br />

1 npm install --no-bin-links<br />

Running Elixir<br />

Elixir is built on top of Gulp¹⁴², so to run your Elixir tasks you only need to run the gulp command<br />

in your terminal. Adding the --production flag to the command will instruct Elixir to minify your<br />

CSS and JavaScript files:<br />

¹⁴⁰http://nodejs.org/download/<br />

¹⁴¹http://gulpjs.com<br />

¹⁴²http://gulpjs.com

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

Saved successfully!

Ooh no, something went wrong!