Skip to content
Permalink
Browse files

fix(options): change option exclude[scripts|styles].from.spaFile to e…

…xclude.from.spaFile[scripts|styles]
  • Loading branch information
jyounce committed Jul 10, 2015
1 parent 09fea01 commit 136c042a2582faf5de3e2da1a0d4f1d5a465d092
@@ -133,7 +133,7 @@ gulp rapid-build:prod
# minify.spa.file = (boolean) defaults to true = for prod build, minify the spa.html file
# minify.cacheBust = (boolean) defaults to true = for prod build, ensures the user always receives the latest files, adds an md5 checksum to the client files before their extension
# exclude.angular.files = (boolean) defaults to false = set to true to exclude the angular files that come with rapid-build from dist (lib and modules)
# exclude[scripts|styles].from.spaFile = (array of strings) = file paths: exclude script or style files from automatically being generated in the spa.html file
# exclude.from.spaFile[scripts|styles] = (array of strings) = file paths: exclude script or style files from automatically being generated in the spa.html file
# ========================================================================================================================================================================================================================
```

@@ -13,8 +13,8 @@ module.exports = (config, options) ->
opt = options.exclude[type][opt]
return defaultVal if isType.null opt
opt
deep3: (type, opt, defaultVal) ->
opt = options.exclude[type].from[opt]
deep3: (opt, type, defaultVal) ->
opt = options.exclude.from[opt][type]
return defaultVal if isType.null opt
opt

@@ -24,40 +24,38 @@ module.exports = (config, options) ->
angular:
files: get.opt.deep2 'angular', 'files', false
rb:
scripts:
from:
minFile: []
spaFile: []
styles:
from:
minFile: []
spaFile: []
from:
minFile:
scripts: []
styles: []
spaFile:
scripts: []
styles: []
app:
scripts:
from:
minFile: get.opt.deep3 'scripts', 'minFile', []
spaFile: get.opt.deep3 'scripts', 'spaFile', []
styles:
from:
minFile: get.opt.deep3 'styles', 'minFile', []
spaFile: get.opt.deep3 'styles', 'spaFile', []
from:
minFile:
scripts: get.opt.deep3 'minFile', 'scripts', []
styles: get.opt.deep3 'minFile', 'styles', []
spaFile:
scripts: get.opt.deep3 'spaFile', 'scripts', []
styles: get.opt.deep3 'spaFile', 'styles', []

# format options
# ==============
formatFilesFrom = (type, opt) -> # prepend dist path to values then prepend '!'
formatFilesFrom = (opt, type) -> # prepend dist path to values then prepend '!'
for appOrRb in ['app','rb']
_paths = exclude[appOrRb][type].from[opt]
_paths = exclude[appOrRb].from[opt][type]
continue if not _paths.length
_paths = (pathHelp.makeRelative _path for _path in _paths)
_paths = (path.join config.dist[appOrRb].client.dir, _path for _path in _paths)
_paths = ("!#{_path}" for _path in _paths)
# log.json _paths
exclude[appOrRb][type].from[opt] = _paths
exclude[appOrRb].from[opt][type] = _paths

formatFilesFrom 'scripts', 'minFile'
formatFilesFrom 'scripts', 'spaFile'
formatFilesFrom 'styles', 'minFile'
formatFilesFrom 'styles', 'spaFile'
formatFilesFrom 'minFile', 'scripts'
formatFilesFrom 'minFile', 'styles'
formatFilesFrom 'spaFile', 'scripts'
formatFilesFrom 'spaFile', 'styles'

# add exclude to config
# =====================
@@ -38,8 +38,9 @@
# minify.spa.file = (boolean) defaults to true
# minify.cacheBust = (boolean) defaults to true
# exclude.angular.files = (boolean) defaults to false
# exclude[scripts|styles].from.spaFile = (array of strings) = file paths: exclude script or style files from automatically being generated in the spa.html file
# exclude[scripts|styles].from.minFile = (array of strings) = file paths: exclude script or style files from automatically being generated in the scripts.min.js or styles.min.css file
# exclude.from.cacheBust = (array of strings) = file paths: exclude files from the cache bust
# exclude.from.spaFile[scripts|styles] = (array of strings) = file paths: exclude script or style files from automatically being generated in the spa.html file
# exclude.from.minFile[scripts|styles] = (array of strings) = file paths: exclude script or style files from automatically being generated in the scripts.min.js or styles.min.css file
# =============================================================================================================================================================================================
module.exports = (config, options) ->
log = require "#{config.req.helpers}/log"
@@ -120,15 +121,15 @@ module.exports = (config, options) ->
excludeOptions = ->
options.exclude = {} if not isType.object options.exclude
options.exclude.angular = {} if not isType.object options.exclude.angular
options.exclude.scripts = {} if not isType.object options.exclude.scripts
options.exclude.styles = {} if not isType.object options.exclude.styles
options.exclude.scripts.from = {} if not isType.object options.exclude.scripts.from
options.exclude.styles.from = {} if not isType.object options.exclude.styles.from
options.exclude.angular.files = null if not isType.boolean options.exclude.angular.files
options.exclude.scripts.from.minFile = null if not isType.array options.exclude.scripts.from.minFile
options.exclude.scripts.from.spaFile = null if not isType.array options.exclude.scripts.from.spaFile
options.exclude.styles.from.minFile = null if not isType.array options.exclude.styles.from.minFile
options.exclude.styles.from.spaFile = null if not isType.array options.exclude.styles.from.spaFile
options.exclude.from = {} if not isType.object options.exclude.from
options.exclude.angular.files = null if not isType.boolean options.exclude.angular.files
options.exclude.from.cacheBust = null if not isType.array options.exclude.from.cacheBust
options.exclude.from.minFile = {} if not isType.object options.exclude.from.minFile
options.exclude.from.spaFile = {} if not isType.object options.exclude.from.spaFile
options.exclude.from.minFile.scripts = null if not isType.array options.exclude.from.minFile.scripts
options.exclude.from.minFile.styles = null if not isType.array options.exclude.from.minFile.styles
options.exclude.from.spaFile.scripts = null if not isType.array options.exclude.from.spaFile.scripts
options.exclude.from.spaFile.styles = null if not isType.array options.exclude.from.spaFile.styles

# init
# ====
@@ -23,7 +23,7 @@ module.exports = (gulp, config) ->
# globs
# =====
getExcludes = (appOrRb, type, glob) ->
spaExcludes = config.exclude[appOrRb][type].from.spaFile
spaExcludes = config.exclude[appOrRb].from.spaFile[type]
return glob if not spaExcludes.length
glob = glob.concat spaExcludes
glob
@@ -38,7 +38,7 @@ module.exports = (gulp, config) ->
# globs
# =====
getExcludes = (appOrRb, type, glob) ->
spaExcludes = config.exclude[appOrRb][type].from.spaFile
spaExcludes = config.exclude[appOrRb].from.spaFile[type]
return glob if not spaExcludes.length
glob = glob.concat spaExcludes
# log.json glob, "#{appOrRb} #{type}"
@@ -31,10 +31,10 @@ module.exports = (gulp, config) ->
# =======
getExcludes = ->
[].concat(
config.exclude.rb.scripts.from.spaFile
config.exclude.rb.styles.from.spaFile
config.exclude.app.scripts.from.spaFile
config.exclude.app.styles.from.spaFile
config.exclude.rb.from.spaFile.scripts
config.exclude.rb.from.spaFile.styles
config.exclude.app.from.spaFile.scripts
config.exclude.app.from.spaFile.styles
)

getFilesDelSrc = ->
@@ -16,7 +16,7 @@ module.exports = (gulp, config) ->
libs: config.glob.dist[appOrRb].client.libs[lang]
first: config.order[appOrRb][type].first
last: config.order[appOrRb][type].last
exclude: config.exclude[appOrRb][type].from.spaFile
exclude: config.exclude[appOrRb].from.spaFile[type]
globs[glob]

getGlobs = (appOrRb, type, _globs) ->

0 comments on commit 136c042

Please sign in to comment.
You can’t perform that action at this time.