Created
February 5, 2014 21:46
-
-
Save motionharvest/8833849 to your computer and use it in GitHub Desktop.
This file contains 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 gulp = require('gulp'), | |
sass = require('gulp-ruby-sass'), | |
compass = require('gulp-compass'), | |
plumber = require('gulp-plumber'), | |
// autoprefixer = require('gulp-autoprefixer'), | |
minifycss = require('gulp-minify-css'), | |
jshint = require('gulp-jshint'), | |
uglify = require('gulp-uglify'), | |
rename = require('gulp-rename'), | |
clean = require('gulp-clean'), | |
concat = require('gulp-concat'), | |
notify = require('gulp-notify'), | |
cache = require('gulp-cache'), | |
livereload = require('gulp-livereload'), | |
lr = require('tiny-lr'), | |
watch = require('gulp-watch'), | |
server = lr(); | |
gulp.task('default', ['watch']); | |
var dir = { | |
sass : './sass/**/*.scss', | |
custom: './preprocess/**/*.scss', | |
html: './*.html', | |
js: './js/**/*.js' | |
} | |
/* | |
gulp watch | |
-> Create server for LiveReload Chrome Extension (working) | |
-> Watch folder, and update when ready | |
*/ | |
gulp.task('watch', function(){ | |
server.listen(35729, function (err) { | |
if (err) { | |
return console.log(err) | |
}; | |
}); | |
gulp.watch(dir.sass, ['gumbyCompile']); | |
gulp.watch(dir.custom, ['customCompile']); | |
gulp.watch([dir.html, dir.js], ['reload']); | |
}); | |
/* | |
compile with compass | |
*/ | |
gulp.task('gumbyCompile', function(){ | |
console.log("[gumbyComple] Running..."); | |
gulp.src(dir.sass) | |
.pipe(compass({ | |
config_file: './config.rb', | |
css: 'css', | |
require: ['susy', 'modular-scale'] | |
})) | |
.pipe(gulp.dest('./css/')) | |
.pipe(livereload(server)); | |
}); | |
gulp.task('customCompile', function(e){ | |
console.log("[customComple] Running...", e); | |
gulp.src(dir.custom) | |
.pipe(compass({ | |
css: 'css', | |
sass: 'preprocess' | |
})) | |
.pipe(gulp.dest('./css/')) | |
.pipe(livereload(server)); | |
}); | |
/* | |
Reload the server | |
*/ | |
gulp.task('reload', function(){ | |
console.log("[reload] Running..."); | |
gulp.src('index.html') | |
.pipe(livereload(server)); | |
}); | |
/* | |
Give internal access via buffer | |
*/ | |
var stdin = process.openStdin(); | |
stdin.setEncoding( 'utf8' ); | |
var abilities = { | |
runMe: function (){ | |
console.log("Internal method for controlling the server"); | |
} | |
} | |
stdin.on( 'data', function( key ){ | |
key = key.replace(/(\r\n|\n|\r)/gm,""); | |
if(abilities.hasOwnProperty(key)){ | |
abilities[key](); | |
} else { | |
console.log("command not found. these are available:", abilities); | |
} | |
return; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment