Last active
August 29, 2015 14:16
-
-
Save scarnago/97673a4af54805490850 to your computer and use it in GitHub Desktop.
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
{ | |
"directory": "dist/components" | |
} |
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
{ | |
"name": "some-website", | |
"private": true | |
} |
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 gulp = require('gulp'), | |
gutil = require('gulp-util'), | |
sass = require('gulp-ruby-sass'), | |
csso = require('gulp-csso'), | |
uglify = require('gulp-uglify'), | |
jade = require('gulp-jade'), | |
concat = require('gulp-concat'), | |
livereload = require('gulp-livereload'), | |
tinylr = require('tiny-lr'), | |
express = require('express'), | |
app = express(), | |
marked = require('marked'), // For :markdown filter in jade | |
path = require('path'), | |
coffee = require('gulp-coffee'), | |
server = tinylr(); | |
// --- Basic Tasks --- | |
gulp.task('css', function() { | |
return gulp.src('src/stylesheets/*.scss') | |
.pipe(sass()) | |
.pipe( gulp.dest('dist/stylesheets/') ) | |
.pipe( livereload( server ) ); | |
}); | |
gulp.task('js', function() { | |
return gulp.src('src/scripts/**/*.coffee') | |
.pipe(coffee({bare: true, courseMap: true}).on('error', console.log)) | |
.pipe( uglify() ) | |
.pipe( concat('all.min.js')) | |
.pipe( gulp.dest('dist/scripts/')) | |
.pipe( livereload( server ) ); | |
}); | |
gulp.task('templates', function() { | |
return gulp.src('src/*.jade') | |
.pipe( jade({ pretty: true })) | |
.pipe( gulp.dest('dist/')) | |
.pipe( livereload( server )); | |
}); | |
gulp.task('express', function() { | |
app.use(require('connect-livereload')()); | |
app.use(express.static(path.resolve('./dist'))); | |
app.listen(3000); | |
gutil.log('Listening on port: 3000'); | |
}); | |
gulp.task('watch', function () { | |
server.listen(35729, function (err) { | |
if (err) return console.log(err); | |
}); | |
gulp.watch('src/stylesheets/**/*.scss',['css']); | |
gulp.watch('src/scripts/**/*.coffee',['js']); | |
gulp.watch('src/*.jade',['templates']); | |
}); | |
// Default Task | |
gulp.task('default', ['js','css','templates','express','watch']); |
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
// Should go in src/index.jade | |
doctype html | |
html | |
head | |
meta(charset='UTF-8') | |
title Title here | |
link(rel='shortcut icon', href='favicon.ico', type='image/vnd.microsoft.icon') | |
// Or whatever name you fancy | |
link(rel='stylesheet', href='/stylesheets/main.css', type='text/css') | |
meta(name="viewport", content="width=device-width, initial-scale=1.0") | |
body | |
h1 Hi. | |
script. | |
// Livereload script, don't forget to install extension! | |
document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment