Skip to content
Permalink
Browse files

feat(options): add ability to exclude angular files from the build

  • Loading branch information
jyounce committed Jun 17, 2015
1 parent 475aaa8 commit 7d06c14caeb7318ef7587dfc018fdb59c939f288
@@ -80,6 +80,7 @@ gulp rapid-build:prod
# angular.version = (string) defaults to '1.x' = semver version required
# angular.templateCache.dev.enable = (boolean) defaults to false = use template cache when running default and dev task
# angular.templateCache.useAbsolutePaths = (boolean) defaults to false = prefix template urls with a '/'
# angular.exclude.files = (boolean) defaults to false = set to true to exclude angular files (lib and modules)
# spa.title = (string) defaults to package.json name or 'Application' = html title tag value
# spa.description = (string) defaults to package.json description = html meta description tag value
# 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)
@@ -23,6 +23,11 @@ module.exports = (config, options) ->
# ===========
angular.moduleName = options.angular.moduleName or 'app'

# exclude
# =======
angular.exclude = {}
angular.exclude.files = options.angular.exclude.files or false

# template cache
# ==============
angular.templateCache = {}
@@ -20,13 +20,17 @@
# angular.moduleName = (string) application module name
# angular.templateCache.dev.enable = (boolean) defaults to false
# angular.templateCache.useAbsolutePaths = (boolean) defaults to false
# angular.exclude.files = (boolean) defaults to false
# spa.title = (string) defaults to package.json name
# spa.description = (string) defaults to package.json description
# 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.styles = (boolean) defaults to false
# spa.exclude.scripts = (boolean) defaults to false
# spa.exclude.title = (boolean) defaults to false
# spa.exclude.moduleName = (boolean) defaults to false
# spa.exclude.description = (boolean) defaults to false
# ===============================================================================================================================
module.exports = (config, options) ->
log = require "#{config.req.helpers}/log"
@@ -70,6 +74,8 @@ module.exports = (config, options) ->
options.angular.modules = null if not isType.array options.angular.modules
options.angular.version = null if not isType.string options.angular.version
options.angular.moduleName = null if not isType.string options.angular.moduleName
options.angular.exclude = {} if not isType.object options.angular.exclude
options.angular.exclude.files = null if not isType.boolean options.angular.exclude.files
options.angular.templateCache = {} if not isType.object options.angular.templateCache
options.angular.templateCache.useAbsolutePaths = null if not isType.boolean options.angular.templateCache.useAbsolutePaths
options.angular.templateCache.dev = {} if not isType.object options.angular.templateCache.dev
@@ -85,8 +91,11 @@ module.exports = (config, options) ->
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.exclude.styles = null if not isType.boolean options.spa.exclude.styles
options.spa.exclude.scripts = null if not isType.boolean options.spa.exclude.scripts
options.spa.exclude.styles = null if not isType.boolean options.spa.exclude.styles
options.spa.exclude.scripts = null if not isType.boolean options.spa.exclude.scripts
options.spa.exclude.title = null if not isType.boolean options.spa.exclude.title
options.spa.exclude.moduleName = null if not isType.boolean options.spa.exclude.moduleName
options.spa.exclude.description = null if not isType.boolean options.spa.exclude.description

distAndSrcOptions()
serverOptions()
@@ -18,6 +18,15 @@ module.exports = (config, options) ->
libs: config.dist.rb.client.libs.dirName
scripts: getDirName 'rb', 'scripts'
styles: getDirName 'rb', 'styles'

rb.files =
rb: ["#{rb.scripts}/app"]
angular: [
"#{rb.bower}/angular"
"#{rb.bower}/angular-resource"
"#{rb.bower}/angular-route"
"#{rb.bower}/angular-sanitize"
]

# init order
# =========
@@ -35,13 +44,9 @@ module.exports = (config, options) ->

# rb order
# ========
order.rb.scripts.first = [
"#{rb.bower}/angular"
"#{rb.bower}/angular-resource"
"#{rb.bower}/angular-route"
"#{rb.bower}/angular-sanitize"
"#{rb.scripts}/app"
]
files = []
files = files.concat rb.files.angular if not options.angular.exclude.files
order.rb.scripts.first = files.concat rb.files.rb

# process order
# =============
@@ -47,8 +47,11 @@ module.exports = (config, options) ->
# exclude
# =======
spa.exclude =
styles: options.spa.exclude.styles or false
scripts: options.spa.exclude.scripts or false
styles: options.spa.exclude.styles or false
scripts: options.spa.exclude.scripts or false
title: options.spa.exclude.title or false
moduleName: options.spa.exclude.moduleName or false
description: options.spa.exclude.description or false

# add spa to config
# =================
@@ -33,17 +33,21 @@ module.exports = (gulp, config) ->
defer.resolve()
defer.promise

getComponents = (appOrRb, exclude) ->
return if exclude
defer = q.defer()
defer.resolve()
defer.promise
runTask(
bowerHelper.get.src appOrRb
config.dist[appOrRb].client.bower.dir
)

runTasks = ->
defer = q.defer()
q.all([
runTask(
bowerHelper.get.src 'rb'
config.dist.rb.client.bower.dir
)
runTask(
bowerHelper.get.src 'app'
config.dist.app.client.bower.dir
)
getComponents 'rb', config.angular.exclude.files
getComponents 'app'
]).done -> defer.resolve()
defer.promise

0 comments on commit 7d06c14

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