Skip to content

Instantly share code, notes, and snippets.

@LoveAndHappiness
Last active January 12, 2016 16:16
Show Gist options
  • Save LoveAndHappiness/9e57846511c7dc43baf9 to your computer and use it in GitHub Desktop.
Save LoveAndHappiness/9e57846511c7dc43baf9 to your computer and use it in GitHub Desktop.
Polymer Gulpfile
/*jslint white:true */
/* Install All Packages */
// npm install gulp gulp-sass browser-sync --save-dev
// bower install polymer --save
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var baseDir = 'app';
var distDir = 'dist';
/* Prepare Browser-sync for localhost */
gulp.task('browser-sync', function() {
'use strict';
browserSync.init(['css/*.css', 'js/*.js'], {
proxy: 'test10.dev',
open: false,
browser: ['chrome']
});
});
/* Compile scss */
gulp.task('sass', function () {
'use strict';
gulp.src([
'resources/assets/sass/app.scss'
])
.pipe(sass())
.pipe(gulp.dest(baseDir + '/css'))
/* Reload the browser CSS after every change */
.pipe(reload({stream:true}));
});
/* Reload browser after file changes */
gulp.task('bs-reload', function () {
'use strict';
browserSync.reload();
});
/* Watch scss and html files */
gulp.task('default', ['sass', 'browser-sync'], function () {
'use strict';
/* Watch scss, run the sass task on change. */
gulp.watch(['resources/assets/sass/**/*.scss'], ['sass']);
/* Watch .html files, run the bs-reload task on change. */
gulp.watch(['*.html', '**/*.html', '**/**/*.html',], ['bs-reload']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment