Skip to content

Instantly share code, notes, and snippets.

@LoveAndHappiness
Last active September 24, 2016 23:13
Show Gist options
  • Save LoveAndHappiness/cd530c5e57a95b80e330 to your computer and use it in GitHub Desktop.
Save LoveAndHappiness/cd530c5e57a95b80e330 to your computer and use it in GitHub Desktop.
Laravel+Polymer Gulpfile
var elixir = require('laravel-elixir');
var gulp = require('gulp');
var vulcanize = require('gulp-vulcanize');
// npm install --save-dev browser-sync gulp-vulcanize vulcanize
/*
|--------------------------------------------------------------------------
| 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 Sass
| file for our application, as well as publishing vendor resources.
|
*/
elixir(function(mix) {
mix.sass('app.scss')
// .copy('bower_components/**/*', 'public/bower_components')
// vulcanize the elements.html in public
// .task('vulcanize', 'resources/**/*')
.task('copy-elements', 'resources/**/*')
.task('copy-bower')
.scripts([
'resources/assets/js/app.js'
], 'public/js/app.js')
.browserSync({ proxy: 'laravel.dev', open: false });
});
gulp.task('vulcanize', function () {
return gulp.src('public/elements/elements.vulcanized.html')
.pipe(vulcanize({
stripComments: true,
inlineCss: true,
inlineScripts: true
}))
.pipe(gulp.dest('public/elements'));
});
gulp.task('copy-elements', function () {
return gulp.src([
'resources/assets/elements/**/*.html',
'resources/assets/elements/*.html',
'resources/assets/styles/*.html'
])
.pipe(gulp.dest('public/elements'));
});
gulp.task('copy-bower', function () {
return gulp.src([
'bower_components/**/*'
])
.pipe(gulp.dest('public/bower_components'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment