Skip to content

Instantly share code, notes, and snippets.

@kingsloi
Created April 30, 2015 18:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingsloi/1a5e809e0aaf7673644e to your computer and use it in GitHub Desktop.
Save kingsloi/1a5e809e0aaf7673644e to your computer and use it in GitHub Desktop.
Laravel Elixir/Gulp
var elixir = require('laravel-elixir');
require('laravel-elixir-browsersync');
// PARAMS - is --production?
var inProduction = elixir.config.production;
// PATHS - Bower
var bower_path = "./resources/assets/bower";
var paths = {
'jquery' : bower_path + "/jquery/dist",
'bootstrap' : bower_path + "/bootstrap-sass-official/assets",
'fontawesome': bower_path + "/Font-Awesome"
};
/*
|--------------------------------------------------------------------------
| 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 Less
| file for our application, as well as publishing vendor resources.
|
*/
elixir(function(mix) {
// SCSS - Main
mix.sass("app.scss", "./public/css", {
includePaths: [
paths.bootstrap + '/stylesheets',
paths.fontawesome + '/scss'
]
});
// COPY - Font Awesome
mix.copy(paths.fontawesome+'/fonts', 'public/fonts');
// JS - Vendor
mix.scripts([
paths.jquery + '/jquery.js',
paths.bootstrap + '/javascripts/bootstrap.js'
], 'public/js/vendor.js','resources');
// JS - App
mix.scripts([
'assets/js/app.js',
], 'public/js/app.js','resources');
// IF - if not `gulp --production`
if (! inProduction) {
// LIVERELOAD - on `gulp watch`
mix.BrowserSync({
proxy : "app.dev",
logPrefix : "App",
logConnections : false,
reloadOnRestart : false,
notify : false
});
}
// VERSION - Version the files!
mix.version(['public/js/vendor.js','public/js/app.js', 'public/css/app.css']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment