Skip to content

Instantly share code, notes, and snippets.

@DaveAtDog
Last active August 29, 2015 14:00
Show Gist options
  • Save DaveAtDog/11393949 to your computer and use it in GitHub Desktop.
Save DaveAtDog/11393949 to your computer and use it in GitHub Desktop.
Basic package.json and gulpfile.js for SASS compilation and live reload.
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
livereload = require('gulp-livereload'),
rename = require('gulp-rename'),
autoprefixer = require('gulp-autoprefixer');
var paths = {
styles: './css/demo.scss',
html: 'index.html'
};
gulp.task('watch', function()
{
gulp.watch(paths.styles, ['styles']);
gulp.watch(paths.html, ['html']);
});
gulp.task('html', function()
{
var stream = gulp.src(paths.html)
.pipe(livereload());
return stream;
});
gulp.task('styles', function()
{
var dest = './css';
var stream = gulp.src(paths.styles)
.pipe(sass(
{
style: 'expanded'
}))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(rename(
{
suffix: '.min'
}))
// .pipe(minifycss())
.pipe(gulp.dest(dest))
.pipe(livereload());
return stream;
});
// Default task
gulp.task('default', ['styles', 'html', 'watch']);
{
"name": "",
"version": "0.0.0",
"description": "",
"main": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "",
"devDependencies": {
"gulp": "^3.6.2",
"gulp-ruby-sass": "^0.4.3",
"gulp-livereload": "^1.3.1",
"gulp-autoprefixer": "0.0.7",
"gulp-rename": "^1.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment