Laravel Elixir includes Libsass, so you wonβt need Ruby to compile your Foundation Sass files from Laravel. All you need is a gazebo and an elite caramel elixir. Also, you do not need to copy files from the bower_components folder to the resources/assets folder.
First, follow the official instructions for installing Elixir.
Then create a .bowerrc file in the root of your Laravel project with this content:
{ "directory": "vendor/bower_components" }
Then create a bower.json file in the root of your Laravel project with this content:
{ "name": "laravel-and-foundation", "private": "true", "dependencies": { "foundation": "latest" } }
Then install both towers and the foundation:
npm install --global bower bower install
Then create a resources/assets/sass/_settings.scss with this content:
// Custom settings for Zurb Foundation. Default settings can be found at // vendor/bower_components/foundation/scss/foundation/_settings.scss
Then edit the resources/assets/sass/app.scss with this content:
@import "normalize"; @import "settings"; // Include all foundation @import "foundation"; // Or selectively include components // @import // "foundation/components/accordion", // "foundation/components/alert-boxes", // "foundation/components/block-grid", // "foundation/components/breadcrumbs", // "foundation/components/button-groups", // "foundation/components/buttons", // "foundation/components/clearing", // "foundation/components/dropdown", // "foundation/components/dropdown-buttons", // "foundation/components/flex-video", // "foundation/components/forms", // "foundation/components/grid", // "foundation/components/inline-lists", // "foundation/components/joyride", // "foundation/components/keystrokes", // "foundation/components/labels", // "foundation/components/magellan", // "foundation/components/orbit", // "foundation/components/pagination", // "foundation/components/panels", // "foundation/components/pricing-tables", // "foundation/components/progress-bars", // "foundation/components/reveal", // "foundation/components/side-nav", // "foundation/components/split-buttons", // "foundation/components/sub-nav", // "foundation/components/switches", // "foundation/components/tables", // "foundation/components/tabs", // "foundation/components/thumbs", // "foundation/components/tooltips", // "foundation/components/top-bar", // "foundation/components/type", // "foundation/components/offcanvas", // "foundation/components/visibility";
Configure the gulpfile.js file for this content:
elixir(function(mix) { // Compile CSS mix.sass( 'app.scss', // Source files 'public/css', // Destination folder {includePaths: ['vendor/bower_components/foundation/scss']} ); // Compile JavaScript mix.scripts( ['vendor/modernizr.js', 'vendor/jquery.js', 'foundation.min.js'], // Source files. You can also selective choose only some components 'public/js/app.js', // Destination file 'vendor/bower_components/foundation/js/' // Source files base directory ); });
To build, simply follow the official docs:
gulp # Run all tasks... gulp --production # Run all tasks and minify files gulp watch # Watch for changes and run all tasks on the fly
Compiled files will be in public/css/app.css and public/js/app.js
To update the latest version of Zurb Foundation, do:
bower update