From 44978c9fa216f6250fe749ffba80c01a0ca82de0 Mon Sep 17 00:00:00 2001 From: neil paul molina Date: Tue, 30 Sep 2014 00:31:37 +0800 Subject: [PATCH] initialized --- .gitignore | 2 ++ README.md | 1 + gulpfile.coffee | 55 +++++++++++++++++++++++++++++ gulpfile.js | 66 +++++++++++++++++++++++++++++++++++ package.json | 17 +++++++++ src/app.coffee | 37 ++++++++++++++++++++ src/assets/style/style.scss | 26 ++++++++++++++ src/controllers/.gitkeep | 1 + src/models/.gitkeep | 2 ++ src/views/index.jade | 7 ++++ src/views/layout/footer.jade | 2 ++ src/views/layout/header.jade | 3 ++ src/views/layout/layout.jade | 45 ++++++++++++++++++++++++ src/views/layout/meta.jade | 1 + src/views/layout/scripts.jade | 2 ++ src/views/layout/styles.jade | 1 + 16 files changed, 268 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 gulpfile.coffee create mode 100644 gulpfile.js create mode 100644 package.json create mode 100644 src/app.coffee create mode 100644 src/assets/style/style.scss create mode 100644 src/controllers/.gitkeep create mode 100644 src/models/.gitkeep create mode 100644 src/views/index.jade create mode 100644 src/views/layout/footer.jade create mode 100644 src/views/layout/header.jade create mode 100644 src/views/layout/layout.jade create mode 100644 src/views/layout/meta.jade create mode 100644 src/views/layout/scripts.jade create mode 100644 src/views/layout/styles.jade diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d0f920 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +app/ +node_modules/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..4101588 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +#Hapi Coffee \ No newline at end of file diff --git a/gulpfile.coffee b/gulpfile.coffee new file mode 100644 index 0000000..726399a --- /dev/null +++ b/gulpfile.coffee @@ -0,0 +1,55 @@ +gulp = require 'gulp' +jade = require 'gulp-jade' +gutil = require 'gulp-util' +sass = require 'gulp-sass' +coffee = require 'gulp-coffee' +nodemon = require 'gulp-nodemon' +app = null +sources = + jade: "src/**/*.jade" + coffee: "src/**/*.coffee" + sass: "src/**/*.scss" + overwatch: "src/**/*.{js,html,css}" + + + + +gulp.task "jade", (event) -> + gulp.src [sources.jade], + base:"./src" + .pipe(jade(pretty: true)) + .pipe gulp.dest("./app") + +gulp.task 'coffee', (event) -> + gulp.src [sources.coffee], + base:"./src" + .pipe(coffee()) + .pipe gulp.dest("./app") + +gulp.task "sass", (event) -> + gulp.src [sources.sass], + base:"./src" + .pipe(sass(style: "compressed")) + .pipe gulp.dest("./app") + +gulp.task "watch", -> + gulp.watch sources.jade, ["jade"] + gulp.watch sources.sass, ["sass"] + gulp.watch sources.coffee, ["coffee"] + return + +gulp.task "develop", -> + nodemon + script:"app/app.js" + ext:"html js" + ignore:["./app/assets/**","./app/views/**"] + .on "restart", -> + console.log "RESTARTED!" + +gulp.task "default", [ + "jade" + "coffee" + "sass" + "develop" + "watch" +] \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..4f22588 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,66 @@ +// Generated by CoffeeScript 1.8.0 +(function() { + var app, coffee, gulp, gutil, jade, nodemon, sass, sources; + + gulp = require('gulp'); + + jade = require('gulp-jade'); + + gutil = require('gulp-util'); + + sass = require('gulp-sass'); + + coffee = require('gulp-coffee'); + + nodemon = require('gulp-nodemon'); + + app = null; + + sources = { + jade: "src/**/*.jade", + coffee: "src/**/*.coffee", + sass: "src/**/*.scss", + overwatch: "src/**/*.{js,html,css}" + }; + + gulp.task("jade", function(event) { + return gulp.src([sources.jade], { + base: "./src" + }).pipe(jade({ + pretty: true + })).pipe(gulp.dest("./app")); + }); + + gulp.task('coffee', function(event) { + return gulp.src([sources.coffee], { + base: "./src" + }).pipe(coffee()).pipe(gulp.dest("./app")); + }); + + gulp.task("sass", function(event) { + return gulp.src([sources.sass], { + base: "./src" + }).pipe(sass({ + style: "compressed" + })).pipe(gulp.dest("./app")); + }); + + gulp.task("watch", function() { + gulp.watch(sources.jade, ["jade"]); + gulp.watch(sources.sass, ["sass"]); + gulp.watch(sources.coffee, ["coffee"]); + }); + + gulp.task("develop", function() { + return nodemon({ + script: "app/app.js", + ext: "html js", + ignore: ["./app/assets/**", "./app/views/**"] + }).on("restart", function() { + return console.log("RESTARTED!"); + }); + }); + + gulp.task("default", ["jade", "coffee", "sass", "develop", "watch"]); + +}).call(this); diff --git a/package.json b/package.json new file mode 100644 index 0000000..e226a67 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "gulp-boilerplate", + "version": "0.1.0", + "description": "a starting point for using gulp", + "devDependencies": { + "gulp": "latest", + "gulp-coffee": "latest", + "gulp-jade": "latest", + "gulp-nodemon": "^1.0.4", + "gulp-sass": "latest", + "gulp-util": "latest" + }, + "dependencies": { + "good": "^2.3.0", + "hapi": "^6.9.0" + } +} diff --git a/src/app.coffee b/src/app.coffee new file mode 100644 index 0000000..6786043 --- /dev/null +++ b/src/app.coffee @@ -0,0 +1,37 @@ +Hapi = require("hapi") +Good = require("good") +Path = require "path" +serverOptions = + views: + path:"./app/views" + engines: + html:"" + +server = new Hapi.Server(3000) + +initialize = (cb)-> + + server.route + method: "GET" + path: "/" + handler: (request, reply) -> + reply "hello world" + return + + server.route + method:"GET" + path:"/assets/{param*}" + handler: + directory: + path:"./assets/" + listing:true + + server.pack.register Good, (err) -> + throw err if err # something bad happened loading the plugin + server.start -> + server.log "info", "Server running at: " + server.info.uri + cb() if cb + return + return + return +initialize() diff --git a/src/assets/style/style.scss b/src/assets/style/style.scss new file mode 100644 index 0000000..4e26449 --- /dev/null +++ b/src/assets/style/style.scss @@ -0,0 +1,26 @@ +$header-color: #A0D468; +body { + color:blue; + padding: 0 0 0 0; + margin: 0 0 0 0; +} +h1 { + font-size: 3em; +} +header { + background-color: $header-color; +} +header h1 { + text-align: center; + margin: 0 0 0 0; + padding: 2em; + color: #FFF; +} +footer { + text-align: center; + color: #888; +} +.center { + text-align: center; + color: #555; +} \ No newline at end of file diff --git a/src/controllers/.gitkeep b/src/controllers/.gitkeep new file mode 100644 index 0000000..2fa992c --- /dev/null +++ b/src/controllers/.gitkeep @@ -0,0 +1 @@ +keep diff --git a/src/models/.gitkeep b/src/models/.gitkeep new file mode 100644 index 0000000..79a6188 --- /dev/null +++ b/src/models/.gitkeep @@ -0,0 +1,2 @@ +keep + diff --git a/src/views/index.jade b/src/views/index.jade new file mode 100644 index 0000000..5a8bd4e --- /dev/null +++ b/src/views/index.jade @@ -0,0 +1,7 @@ +extends layout/layout + +block content + h2.center. + A really simple gulp boilerplate that sets up a static server with express that livereloads + h2.center. + It also is set up with jade, sass, and coffeescript tasks. \ No newline at end of file diff --git a/src/views/layout/footer.jade b/src/views/layout/footer.jade new file mode 100644 index 0000000..aaab28c --- /dev/null +++ b/src/views/layout/footer.jade @@ -0,0 +1,2 @@ +footer.my-footer. + gulp-boilerplate © 2014 diff --git a/src/views/layout/header.jade b/src/views/layout/header.jade new file mode 100644 index 0000000..fd9718e --- /dev/null +++ b/src/views/layout/header.jade @@ -0,0 +1,3 @@ +header.my-header + h1. + gulp boilerplate \ No newline at end of file diff --git a/src/views/layout/layout.jade b/src/views/layout/layout.jade new file mode 100644 index 0000000..060ab49 --- /dev/null +++ b/src/views/layout/layout.jade @@ -0,0 +1,45 @@ +doctype html +//if lt IE 7 + html.no-js.lt-ie9.lt-ie8.lt-ie7(lang="en") +//if IE 7 + html.no-js.lt-ie9.lt-ie8(lang="en") +//if IE 8 + html.no-js.lt-ie9(lang="en") +//if gt IE 8 + html.no-js(lang="en") +head + meta(charset="utf-8") + meta(http-equiv="X-UA-Compatible", content="IE=edge") + title. + gulp boilerplate + meta(name="viewport", content="width=device-width, initial-scale=1, user-scalable=0, maximum-scale=1.0") + //Place favicon.ico and apple-touch-icon.png in the root directory + include meta + block meta + include styles + block styles + script(src="js/vendor/modernizr-2.6.2.min.js") + script(src="//code.jquery.com/jquery-2.1.0.min.js") +body + //if lt IE 7 + p.browsehappy + |You are using an + strong + |outdated browser + |. Please + a(href="http://browsehappy.com/") + |upgrade your browser + |to improve your experience. + include header + block content + include footer + include scripts + block scripts + // Google Analytics: change UA-XXXXX-X to be your sites ID. + script. + (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]= + function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date; + e=o.createElement(i);r=o.getElementsByTagName(i)[0]; + e.src='//www.google-analytics.com/analytics.js'; + r.parentNode.insertBefore(e,r)}(window,document,'script','ga')); + ga('create','UA-XXXXX-X');ga('send','pageview'); \ No newline at end of file diff --git a/src/views/layout/meta.jade b/src/views/layout/meta.jade new file mode 100644 index 0000000..488b344 --- /dev/null +++ b/src/views/layout/meta.jade @@ -0,0 +1 @@ +//- GIVE ME SOME META TAGS \ No newline at end of file diff --git a/src/views/layout/scripts.jade b/src/views/layout/scripts.jade new file mode 100644 index 0000000..ede614d --- /dev/null +++ b/src/views/layout/scripts.jade @@ -0,0 +1,2 @@ +//- Feed me scripts here. +script(src = "") \ No newline at end of file diff --git a/src/views/layout/styles.jade b/src/views/layout/styles.jade new file mode 100644 index 0000000..461dff0 --- /dev/null +++ b/src/views/layout/styles.jade @@ -0,0 +1 @@ +link(rel="stylesheet", href="css/style.css") \ No newline at end of file