Skip to content

Commit

Permalink
fix(option): change option spa.exclude to spa.placeholders, makes mor…
Browse files Browse the repository at this point in the history
…e sense
  • Loading branch information
jyounce committed Jun 29, 2015
1 parent dd7a7f8 commit 395cd37
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -124,7 +124,7 @@ gulp rapid-build:prod
# spa.src.file = (string) defaults to 'spa.html' = set if you want to use your own spa file and not the build system's (file must be located in your client src directory)
# spa.src.dir = (string) defaults to null = set if you are using your own spa file and that file is located in a directory in your client src directory
# spa.dist.file = (string) defaults to spa.src.file or 'spa.html' = provide if you want the dist spa file to be named differently, example: 'index.html'
# spa.exclude = (array of strings) = set to retain spa file placeholders, optional values are: ['scripts', 'styles', 'description', 'moduleName', 'title'] or ['all']
# spa.placeholders = (array of strings) = set to retain spa file placeholders, optional values are: ['scripts', 'styles', 'description', 'moduleName', 'title'] or ['all']
# minify.css.styles = (boolean) defaults to true = for prod build, minify the css
# minify.html.views = (boolean) defaults to true = for prod build, minify the html
# minify.html.templateCache = (boolean) defaults to true = for prod build, use the template cache
Expand Down
18 changes: 9 additions & 9 deletions config/config-options.coffee
Expand Up @@ -29,7 +29,7 @@
# spa.src.file = (string) defaults to 'spa.html'
# spa.src.dir = (string) defaults to null
# spa.dist.file = (string) defaults to spa.src.file or 'spa.html'
# spa.exclude = (array of strings) = optionals: ['scripts', 'styles', 'description', 'moduleName', 'title'] or ['all']
# spa.placeholders = (array of strings) = optionals: ['scripts', 'styles', 'description', 'moduleName', 'title'] or ['all']
# minify.css.styles = (boolean) defaults to true
# minify.html.views = (boolean) defaults to true
# minify.html.templateCache = (boolean) defaults to true
Expand Down Expand Up @@ -90,14 +90,14 @@ module.exports = (config, options) ->

spaOptions = ->
options.spa = {} if not isType.object options.spa
options.spa.title = null if not isType.string options.spa.title
options.spa.description = null if not isType.string options.spa.description
options.spa.src = {} if not isType.object options.spa.src
options.spa.dist = {} if not isType.object options.spa.dist
options.spa.exclude = null if not isType.array options.spa.exclude
options.spa.src.dir = null if not isType.string options.spa.src.dir
options.spa.src.file = null if not isType.string options.spa.src.file
options.spa.dist.file = null if not isType.string options.spa.dist.file
options.spa.title = null if not isType.string options.spa.title
options.spa.description = null if not isType.string options.spa.description
options.spa.src = {} if not isType.object options.spa.src
options.spa.dist = {} if not isType.object options.spa.dist
options.spa.placeholders = null if not isType.array options.spa.placeholders
options.spa.src.dir = null if not isType.string options.spa.src.dir
options.spa.src.file = null if not isType.string options.spa.src.file
options.spa.dist.file = null if not isType.string options.spa.dist.file

minifyOptions = ->
options.minify = {} if not isType.object options.minify
Expand Down
6 changes: 3 additions & 3 deletions config/config-spa.coffee
Expand Up @@ -44,9 +44,9 @@ module.exports = (config, options) ->
file: srcFile
path: path.join srcDir, srcFile

# exclude
# =======
spa.exclude = options.spa.exclude or []
# placeholders
# ============
spa.placeholders = options.spa.placeholders or []

# add spa to config
# =================
Expand Down
12 changes: 6 additions & 6 deletions tasks/build/build-spa.coffee
Expand Up @@ -11,13 +11,13 @@ module.exports = (gulp, config) ->
# helpers
# =======
runReplace = (type) ->
newKey = "<%= #{type} %>"
key = "<!--#include #{type}-->"
exclude = config.spa.exclude
replacePH = true # PH = placeholder
if exclude.indexOf('all') isnt -1
newKey = "<%= #{type} %>"
key = "<!--#include #{type}-->"
placeholders = config.spa.placeholders
replacePH = true # PH = placeholder
if placeholders.indexOf('all') isnt -1
replacePH = false
else if exclude.indexOf(type) isnt -1
else if placeholders.indexOf(type) isnt -1
replacePH = false
gulpif replacePH, replace key, newKey

Expand Down

0 comments on commit 395cd37

Please sign in to comment.