Skip to content
Permalink
Browse files

feat(exclude): add option exclude.from.cacheBust

  • Loading branch information
jyounce committed Jul 10, 2015
1 parent 136c042 commit 03d18e1106dc88a43a372be0febf72d81b8e20e2
Showing with 33 additions and 12 deletions.
  1. +11 −8 .gitignore
  2. +1 −0 README.md
  3. +11 −3 config/config-exclude.coffee
  4. +10 −1 config/config-globs.coffee
@@ -1,16 +1,19 @@
.orig
.DS_Store
ehthumbs.db
Thumbs.db
temp/
bower_components/
src/client/scripts/app.coffee
dist/
public/
node_modules/
public/
temp/
.DS_Store
.orig
ehthumbs.db
npm-debug.log
phantomjsdriver.log
test-results.xml
Thumbs.db
/bower.json
config/config.json
files/files.json
/bower.json
src/client/scripts/app.coffee
src/client/images/wolverine.png
src/client/views/docs
src/client/views/rapid-build.html
@@ -133,6 +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.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
# ========================================================================================================================================================================================================================
```
@@ -25,6 +25,7 @@ module.exports = (config, options) ->
files: get.opt.deep2 'angular', 'files', false
rb:
from:
cacheBust: []
minFile:
scripts: []
styles: []
@@ -33,6 +34,7 @@ module.exports = (config, options) ->
styles: []
app:
from:
cacheBust: get.opt.deep2 'from', 'cacheBust', []
minFile:
scripts: get.opt.deep3 'minFile', 'scripts', []
styles: get.opt.deep3 'minFile', 'styles', []
@@ -44,14 +46,20 @@ module.exports = (config, options) ->
# ==============
formatFilesFrom = (opt, type) -> # prepend dist path to values then prepend '!'
for appOrRb in ['app','rb']
_paths = exclude[appOrRb].from[opt][type]
continue if not _paths.length
_paths = exclude[appOrRb].from[opt][type]
forType = !!_paths
_paths = exclude[appOrRb].from[opt] unless forType
continue unless _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].from[opt][type] = _paths
if forType
exclude[appOrRb].from[opt][type] = _paths
else
exclude[appOrRb].from[opt] = _paths

formatFilesFrom 'cacheBust'
formatFilesFrom 'minFile', 'scripts'
formatFilesFrom 'minFile', 'styles'
formatFilesFrom 'spaFile', 'scripts'
@@ -107,11 +107,20 @@ module.exports = (config) ->
# ==========
addCacheBust = (type, lang) ->
_glob = path.join config.dist.app.client.dir, lang
glob.dist.app.client.cacheBust[type] = _glob
glob.dist.app.client.cacheBust[type] = [ _glob ]

addCacheBustExcludes = ->
glob.dist.app.client.cacheBust.files =
[].concat(
glob.dist.app.client.cacheBust.files
config.exclude.rb.from.cacheBust
config.exclude.app.from.cacheBust
)

glob.dist.app.client.cacheBust = {}
addCacheBust 'files', lang.bustFiles
addCacheBust 'references', lang.bustRefs
addCacheBustExcludes()

# methods
# =======

0 comments on commit 03d18e1

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