Skip to content
Permalink
Browse files

feat(option): add build option minify.html.options for full control o…

…ver how the html gets minified
  • Loading branch information
jyounce committed Apr 9, 2016
1 parent c7c61a7 commit f0ab5a26f77a9747fb87b7925a94814ab9f5e1d2
@@ -169,6 +169,7 @@ package.json
# minify.css.splitMinFile = (boolean) defaults to true = for prod build, task for ie9 and below, split styles.min.css into multiple files if selector count > 4,095
# 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
# minify.html.options = (object) defaults to { collapseWhitespace: true, removeComments: true, removeEmptyElements: false, removeEmptyAttributes: false } for details see: https://git.io/vVyAC
# minify.js.scripts = (boolean) defaults to true = for prod build, minify the js
# minify.js.fileName = (string) defaults to 'scripts.min.js'
# minify.js.mangle = (boolean) defaults to true = for prod build, mangle the names in the js
@@ -185,7 +186,7 @@ package.json
# exclude.from.dist[client|server] = (array of strings) = file paths: exclude client or server files from the dist folder
# test.client.browsers = (array of browser names) = phantomjs will run by default, optional browser names are ['chrome', 'firefox', 'ie', 'safari']
# server.node_modules = (array of module names) = node_modules you would like to copy to the server dist, example: ['q']
# httpProxy = (array of objects) = object format: { context: array or string, options: object } for details see: https://www.npmjs.com/package/http-proxy-middleware
# httpProxy = (array of objects) = object format: { context: array or string, options: object } for details see: https://git.io/vVyA0
# browser.open = (boolean) defaults to true = open the browser once the build completes, applies to builds: default, dev and prod:server
# browser.reload = (boolean) defaults to true = reloads the browser once you save your src file, only applies to dev builds
# extra.copy[client|server] = (array of strings) = file paths: additional files to copy to dist/client and or dist/server that the build didn't copy
@@ -15,8 +15,12 @@ getCommonOptions = ->
minify:
spa:
file: false
# html:
# templateCache: false
html:
options:
ignoreCustomFragments: [
/<rb:code(\s*?.*?)*?rb:code>/gi
/<rb:pre(\s*?.*?)*?rb:pre>/gi
]

angular:
moduleName: 'rapid-build'
@@ -27,7 +27,7 @@ <h2>
Install rapid-build by running...
</h2>

<div class="relative">
<div>
<rb:code lang="bash" inline>
$ npm install rapid-build
# or
@@ -32,7 +32,7 @@ module.exports = (config, options) ->
html:
views: getOption 'html', 'views'
templateCache: getOption 'html', 'templateCache'
options: # not configurable
options: # configurable
collapseWhitespace: true
removeComments: true # excludes ie conditionals
removeEmptyElements: false
@@ -43,6 +43,18 @@ module.exports = (config, options) ->
spa:
file: getOption 'spa', 'file'

# html minify options
# ===================
setHtmlMinOpts = ->
for opt, val of options.minify.html.options
rbOpts = minify.html.options
if opt is 'ignoreCustomFragments'
[].push.apply rbOpts[opt], val
continue
rbOpts[opt] = val

setHtmlMinOpts()

# cache bust
# ==========
cacheBustOpt = options.minify.cacheBust
@@ -15,6 +15,7 @@ module.exports = (config, options) ->
minify.css.splitMinFile = null unless isType.boolean minify.css.splitMinFile
minify.html.views = null unless isType.boolean minify.html.views
minify.html.templateCache = null unless isType.boolean minify.html.templateCache
minify.html.options = {} unless isType.object minify.html.options
minify.js.scripts = null unless isType.boolean minify.js.scripts
minify.js.fileName = null unless isType.string minify.js.fileName
minify.js.mangle = null unless isType.boolean minify.js.mangle

0 comments on commit f0ab5a2

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