Skip to content
This repository was archived by the owner on Jan 23, 2018. It is now read-only.

Staying DRY

Sam Rapaport edited this page Jun 26, 2016 · 3 revisions

In addition to the Blade wrapper template, Laravel Kickstart comes configured with an organized Sass and JavaScript file/directory structure to help you modularize and stay DRY.

Scripts

The JavaScript setup is simple, yet powerful. Laravel Kickstart includes one JavaScript file, resources/assets/js/main.js. This acts as your primary JavaScript file and utilizes DOM-based routing to help modularize your code. If you need to add more JavaScript files, place them in resources/assets/js/includes and they will be automatically compiled before your main.js file. All scripts are compiled into public/js/main.js.

Stylesheets

The Sass setup is also very powerful. A main.scss file in the base Sass directory, resources/assets/sass imports all of your stylesheets and compiles them into one file, public/css/main.css. Inside of the base Sass directory, you will find various subdirectories and files which are designed to break up your styles into more maintainable pieces. The setup is almost identical to Sage for WordPress, with some minor changes to better reflect Laravel.

Additional Files

Laravel Kickstart comes with a nice list of Sass and JavaScript files out of the box, but you may find the need to add some more. Don't worry, it's a sinch!

To include additional Sass files, add an @import statement in the resources/assets/sass/main.scss file.

To add additional JavaScript files, remember you can place them directly in resources/assets/js/includes. Of course, you can also explicitly add the path to the dependencies.scripts array in your gulpfile.

Clone this wiki locally