initial commit

This commit is contained in:
Riku Rouvila
2014-01-14 09:15:11 +02:00
commit a88e1a4f7b
11 changed files with 186 additions and 0 deletions

3
.bowerrc Normal file
View File

@@ -0,0 +1,3 @@
{
"directory" : "vendor"
}

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
node_modules
public/*.html
public/css/*.css
public/js/*.js
vendor

11
README.md Normal file
View File

@@ -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

18
bower.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "gulp-template",
"version": "0.0.0",
"authors": [
"Riku Rouvila <riku.rouvila@gmail.com>"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "~1.10.2"
}
}

79
gulpfile.coffee Normal file
View File

@@ -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"

2
gulpfile.js Normal file
View File

@@ -0,0 +1,2 @@
require('coffee-script');
require('./gulpfile.coffee');

27
package.json Normal file
View File

@@ -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"
}
}

2
src/coffee/main.coffee Normal file
View File

@@ -0,0 +1,2 @@
$ = require 'jquery'
console.log 'foobar'

8
src/jade/index.jade Normal file
View File

@@ -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!

27
src/stylus/mixins.styl Normal file
View File

@@ -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)

4
src/stylus/style.styl Normal file
View File

@@ -0,0 +1,4 @@
@import "mixins"
body, html
margin 0