From a88e1a4f7bace1b982ce6b4e53920f278a8a2be4 Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Tue, 14 Jan 2014 09:15:11 +0200 Subject: [PATCH] initial commit --- .bowerrc | 3 ++ .gitignore | 5 +++ README.md | 11 ++++++ bower.json | 18 ++++++++++ gulpfile.coffee | 79 ++++++++++++++++++++++++++++++++++++++++++ gulpfile.js | 2 ++ package.json | 27 +++++++++++++++ src/coffee/main.coffee | 2 ++ src/jade/index.jade | 8 +++++ src/stylus/mixins.styl | 27 +++++++++++++++ src/stylus/style.styl | 4 +++ 11 files changed, 186 insertions(+) create mode 100644 .bowerrc create mode 100644 .gitignore create mode 100644 README.md create mode 100644 bower.json create mode 100644 gulpfile.coffee create mode 100644 gulpfile.js create mode 100644 package.json create mode 100644 src/coffee/main.coffee create mode 100644 src/jade/index.jade create mode 100644 src/stylus/mixins.styl create mode 100644 src/stylus/style.styl diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..3c5e8c3 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory" : "vendor" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c4c5e2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules +public/*.html +public/css/*.css +public/js/*.js +vendor diff --git a/README.md b/README.md new file mode 100644 index 0000000..f7348a5 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Project template for [gulp.js](http://gulpjs.com/) + +## Getting things up and running + + git clone git@github.com:leonidas/gulp-project-template.git + npm install -g gulp + npm install -g bower + npm install + bower install + gulp + open http://localhost:9001 in your browser diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..589370e --- /dev/null +++ b/bower.json @@ -0,0 +1,18 @@ +{ + "name": "gulp-template", + "version": "0.0.0", + "authors": [ + "Riku Rouvila " + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "jquery": "~1.10.2" + } +} diff --git a/gulpfile.coffee b/gulpfile.coffee new file mode 100644 index 0000000..3063e27 --- /dev/null +++ b/gulpfile.coffee @@ -0,0 +1,79 @@ +path = require 'path' +gulp = require 'gulp' +gutil = require 'gulp-util' +jade = require 'gulp-jade' +stylus = require 'gulp-stylus' +CSSmin = require 'gulp-minify-css' +browserify = require 'gulp-browserify' +rename = require 'gulp-rename' +uglify = require 'gulp-uglify' +coffeeify = require 'coffeeify' + +compileCoffee = (debug = false) -> + config = transform: ['coffeeify'] + + config = + debug: debug + transform: ['coffeeify'] + shim: + jquery: + path: './vendor/jquery/jquery.js' + exports: '$' + + bundle = gulp + .src('./src/coffee/main.coffee') + .pipe(browserify(config)) + .pipe(rename('bundle.js')) + + bundle.pipe(uglify()) unless debug + bundle.pipe gulp.dest('public/js/') + +compileJade = (debug = false) -> + gulp + .src('src/jade/*.jade') + .pipe(jade(pretty: debug)) + .pipe(gulp.dest('public/')) + +compileStylus = (debug = false) -> + styles = gulp + .src('src/stylus/style.styl') + .pipe(stylus('include css': true)) + + styles.pipe(CSSmin()) unless debug + + styles.pipe(gulp.dest('public/css/')) + +# Build tasks +gulp.task "jade-production", -> compileJade() +gulp.task 'stylus-production', ->compileStylus() +gulp.task 'coffee-production', -> compileCoffee() + +# Development tasks +gulp.task "jade", -> compileJade(true) +gulp.task 'stylus', -> compileStylus(true) +gulp.task 'coffee', -> compileCoffee(true) + +gulp.task "server", -> + nodeStatic = require('node-static') + staticFiles = new nodeStatic.Server './public' + require('http').createServer (req, res) -> + req.addListener 'end', -> + staticFiles.serve req, res + req.resume() + .listen 9001 + +gulp.task "watch", -> + gulp.watch "src/coffee/*.coffee", -> + gulp.run "coffee" + + gulp.watch "src/jade/*.jade", -> + gulp.run "jade" + + gulp.watch "src/stylus/*.styl", -> + gulp.run "stylus" + +gulp.task "build", -> + gulp.run "coffee-production", "jade-production", "stylus-production" + +gulp.task "default", -> + gulp.run "coffee", "jade", "stylus", "watch", "server" diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..fd92a51 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,2 @@ +require('coffee-script'); +require('./gulpfile.coffee'); diff --git a/package.json b/package.json new file mode 100644 index 0000000..a697961 --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "gulp-template", + "version": "0.0.0", + "description": "Project template for gulp.js", + "main": "gulpfile.js", + "scripts": {}, + "keywords": [ + "gulp", + "template" + ], + "author": "", + "dependencies": { + "coffee-script": "~1.6.3" + }, + "devDependencies": { + "gulp-rename": "~0.2.1", + "gulp-uglify": "~0.1.0", + "gulp-util": "~2.2.9", + "gulp-stylus": "0.0.9", + "gulp-jade": "~0.3.0", + "gulp-browserify": "~0.2.5", + "gulp": "~3.3.1", + "node-static": "~0.7.3", + "gulp-minify-css": "~0.2.0", + "coffeeify": "~0.5.2" + } +} diff --git a/src/coffee/main.coffee b/src/coffee/main.coffee new file mode 100644 index 0000000..f47b483 --- /dev/null +++ b/src/coffee/main.coffee @@ -0,0 +1,2 @@ +$ = require 'jquery' +console.log 'foobar' diff --git a/src/jade/index.jade b/src/jade/index.jade new file mode 100644 index 0000000..41aa204 --- /dev/null +++ b/src/jade/index.jade @@ -0,0 +1,8 @@ +doctype html +html + head + title Gulp template + link(rel='stylesheet', href='css/style.css') + script(src='js/bundle.js') + body + h1 Hello world! diff --git a/src/stylus/mixins.styl b/src/stylus/mixins.styl new file mode 100644 index 0000000..b0ae120 --- /dev/null +++ b/src/stylus/mixins.styl @@ -0,0 +1,27 @@ +vendor(prop, args) + -webkit-{prop} args + -moz-{prop} args + -ms-{prop} args + -o-{prop} args + {prop} args + +border-radius() + vendor('border-radius', arguments) + +user-select() + vendor('user-select', arguments) + +box-shadow() + vendor('box-shadow', arguments) + +box-sizing() + vendor('box-sizing', arguments) + +transition() + vendor('transition', arguments) + +transform() + vendor('transform', arguments) + +animation() + vendor('animation', arguments) diff --git a/src/stylus/style.styl b/src/stylus/style.styl new file mode 100644 index 0000000..0d4d07b --- /dev/null +++ b/src/stylus/style.styl @@ -0,0 +1,4 @@ +@import "mixins" + +body, html + margin 0