Last active
November 29, 2015 16:52
-
-
Save furdarius/8507e5c73bc8edcd14a2 to your computer and use it in GitHub Desktop.
Browserify Angular application gulpfile for Laravel5.1 (Elixir)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
assetsPath: 'resources/backend/assets', | |
publicPath: 'public/backend', | |
angularPath: 'resources/backend/angular/' | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
assetsPath: 'resources/frontend/assets', | |
publicPath: 'public/frontend', | |
angularPath: 'resources/frontend/angular/' | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elixir = require('laravel-elixir'); | |
var gulp = require('gulp'); | |
var _ = require('lodash'); | |
elixir.config.js.browserify.transformers.push({ | |
name: 'browserify-ngannotate', | |
options: {} | |
}); | |
elixir.extend('assign', function(config, settings) { | |
new elixir.Task('assign', function() { | |
return _.assign(config, settings); | |
}) | |
}); | |
function doElixir(mix, settings) { | |
mix.assign(elixir.config, settings) | |
.sass('app.scss') | |
.browserify('../../../' + settings.angularPath + '/index.js', settings.publicPath + '/js/app.js') | |
.browserify('../../../' + settings.assetsPath + '/js/vendor.js', settings.publicPath + '/js/vendor.js') | |
.copy(settings.assetsPath + '/../angular/templates', settings.publicPath + '/templates'); | |
return mix; | |
} | |
gulp.task('backend', ['frontend'], function() { | |
return elixir(function (mix) { | |
return doElixir(mix, require('./gulp/backend.env.js')); | |
}); | |
}); | |
gulp.task('frontend', function() { | |
return elixir(function (mix) { | |
return doElixir(mix, require('./gulp/frontend.env.js')); | |
}); | |
}); | |
gulp.task('default', ['backend'], function() {}); | |
gulp.task('front', ['frontend'], function() {}); | |
gulp.task('watch', ['backend'], function() {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment