Skip to content
Browse files

Add ability to specify a path to a bootstrap tag, instead of only bei…

…ng able to reference a version number.
  • Loading branch information...
1 parent 68628e2 commit 5428b86cb795a4728e7f73b49a707301bba03dfb @jansepar jansepar committed Feb 11, 2013
Showing with 13 additions and 9 deletions.
  1. +12 −8 src/injector.coffee
  2. +1 −1 src/mobify.coffee
View
20 src/injector.coffee
@@ -28,13 +28,17 @@ include = (klass, mixin) ->
getTags = (opts, version) ->
tags = {}
- path = Path.join appSourceDir, 'vendor', 'tags', version + '/'
- FS.readdirSync(path).forEach (filename) ->
- if filename.indexOf('.html') is -1
- return
-
- path = Path.join path, filename
- tags[Path.basename filename, '.html'] = FS.readFileSync(path).toString()
+ if not isNaN(version) # if version is a number
+ path = Path.join appSourceDir, 'vendor', 'tags', version + '/'
+ FS.readdirSync(path).forEach (filename) ->
+ if filename.indexOf('.html') is -1
+ return
+
+ path = Path.join path, filename
+ tags[Path.basename filename, '.html'] = FS.readFileSync(path).toString()
+ else # version is a path to a bootstrap tag
+ tags["bootstrap"] = FS.readFileSync(version).toString()
+
tags
tag = (request, response, content, options) ->
@@ -210,4 +214,4 @@ createServer = (options) ->
module.exports =
createServer: createServer
HttpServer: HttpServer
- HttpsServer: HttpsServer
+ HttpsServer: HttpsServer
View
2 src/mobify.coffee
@@ -21,7 +21,7 @@ program
.option('-a, --address <address>', 'address to bind to [0.0.0.0]', '0.0.0.0')
.option('-m, --minify', 'enable minification')
.option('-t, --tag', 'runs a tag injecting proxy, requires sudo')
- .option('-u, --tag-version <version>', 'version of the tags to use [6]', '6')
+ .option('-u, --tag-version <version>', 'version of the tags to use [6], or a path to a bootstrap script', '6')
.action Commands.preview
program

0 comments on commit 5428b86

Please sign in to comment.
Something went wrong with that request. Please try again.