Skip to content

Commit

Permalink
feat(option): add option minify.css.splitMinFile to disable the split…
Browse files Browse the repository at this point in the history
…ting of styles.min.css
  • Loading branch information
jyounce committed Jun 30, 2015
1 parent 9a40c94 commit 686b3fd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ gulp rapid-build:prod
# spa.exclude.scripts = (array of strings) = file paths: exclude files from automatically being generated in the spa.html and scripts.min.js file
# spa.exclude.styles = (array of strings) = file paths: exclude files from automatically being generated in the spa.html and styles.min.css file
# minify.css.styles = (boolean) defaults to true = for prod build, minify the css
# 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.js.scripts = (boolean) defaults to true = for prod build, minify the js
Expand Down
1 change: 1 addition & 0 deletions config/config-minify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = (config, options) ->
minify =
css:
styles: getOption 'css', 'styles'
splitMinFile: getOption 'css', 'splitMinFile'
js:
scripts: getOption 'js', 'scripts'
mangle: getOption 'js', 'mangle'
Expand Down
2 changes: 2 additions & 0 deletions config/config-options.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# spa.exclude.scripts = (array of strings) = file paths: exclude files from automatically being generated in the spa.html and scripts.min.js file
# spa.exclude.styles = (array of strings) = file paths: exclude files from automatically being generated in the spa.html and styles.min.css file
# minify.css.styles = (boolean) defaults to true
# minify.css.splitMinFile = (boolean) defaults to true
# minify.html.views = (boolean) defaults to true
# minify.html.templateCache = (boolean) defaults to true
# minify.js.scripts = (boolean) defaults to true
Expand Down Expand Up @@ -110,6 +111,7 @@ module.exports = (config, options) ->
options.minify.html = {} if not isType.object options.minify.html
options.minify.js = {} if not isType.object options.minify.js
options.minify.css.styles = null if not isType.boolean options.minify.css.styles
options.minify.css.splitMinFile = null if not isType.boolean options.minify.css.splitMinFile
options.minify.html.views = null if not isType.boolean options.minify.html.views
options.minify.html.templateCache = null if not isType.boolean options.minify.html.templateCache
options.minify.js.scripts = null if not isType.boolean options.minify.js.scripts
Expand Down
10 changes: 6 additions & 4 deletions tasks/minify/css-file-split.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
# If you don't care about those piece of shit browsers, then disable this option.
# ===============================================================================
module.exports = (gulp, config) ->
q = require 'q'
fs = require 'fs'
path = require 'path'
bless = require 'gulp-bless'
q = require 'q'
fs = require 'fs'
path = require 'path'
bless = require 'gulp-bless'
promiseHelp = require "#{config.req.helpers}/promise"

# tasks
# =====
Expand All @@ -34,6 +35,7 @@ module.exports = (gulp, config) ->
# register task
# =============
gulp.task "#{config.rb.prefix.task}css-file-split", ->
return promiseHelp.get() if not config.minify.css.splitMinFile
stylesDir = config.dist.app.client.styles.dir
minFile = config.fileName.styles.min
minPath = path.join stylesDir, minFile
Expand Down

0 comments on commit 686b3fd

Please sign in to comment.