File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ** /node_modules
Original file line number Diff line number Diff line change 1+ var express = require ( 'express' ) ;
2+ var app = express ( ) ;
3+
4+
5+ app . use ( express . static ( '../' , {
6+ extensions : [ 'html' , 'ico' ]
7+ } ) ) ;
8+ app . listen ( 8080 ) ;
Original file line number Diff line number Diff line change 1+ var gulp = require ( 'gulp' ) ;
2+ var path = require ( 'path' ) ;
3+ var through = require ( 'through2' ) ;
4+ var rename = require ( 'gulp-rename' ) ;
5+ var merge = require ( 'merge-stream' ) ;
6+ var Handlebars = require ( 'handlebars' ) ;
7+
8+ gulp . task ( 'partials' , function ( ) {
9+ return gulp . src ( './partials/**/*.hbs' )
10+ . pipe ( through . obj ( function ( file , encoding , callback ) {
11+ Handlebars . registerPartial ( path . basename ( file . path , '.hbs' ) , file . contents . toString ( ) ) ;
12+ return callback ( ) ;
13+ } ) ) ;
14+ } ) ;
15+
16+ gulp . task ( 'templates' , [ 'partials' ] , function ( ) {
17+ return gulp . src ( './templates/**/*.hbs' )
18+ . pipe ( through . obj ( function ( file , encoding , callback ) {
19+ file . contents = new Buffer ( Handlebars . compile ( file . contents . toString ( ) ) ( ) ) ;
20+ this . push ( file ) ;
21+ return callback ( ) ;
22+ } ) )
23+ . pipe ( rename ( {
24+ extname : '.html'
25+ } ) )
26+ . pipe ( gulp . dest ( '../' ) ) ;
27+ } ) ;
28+
29+ gulp . task ( 'default' , [ 'templates' ] ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " mike.fail" ,
3+ "version" : " 0.0.1" ,
4+ "description" : " mike.fail blog" ,
5+ "main" : " app.js" ,
6+ "dependencies" : {
7+ "gulp" : " ^3.8.9" ,
8+ "gulp-rename" : " ^1.2.0" ,
9+ "handlebars" : " ^2.0.0" ,
10+ "merge-stream" : " ^0.1.6" ,
11+ "through2" : " ^0.6.3"
12+ },
13+ "devDependencies" : {
14+ "express" : " ^4.10.0"
15+ },
16+ "author" : " Michael Groshans" ,
17+ "license" : " GPL3"
18+ }
Original file line number Diff line number Diff line change 1+ <h1 >mike.fail</h1 >
Original file line number Diff line number Diff line change 1+ {{> header }}
2+ <p >fail</p >
Original file line number Diff line number Diff line change 1- < h1 > Blog </ h1 >
2- < p > Awesome content! </ p >
1+ < h1 > mike.fail </ h1 >
2+ < p > fail </ p >
You can’t perform that action at this time.
0 commit comments