Skip to content
Permalink
Browse files

feat(option): add option exclude.from.dist[client|server]

  • Loading branch information
jyounce committed Aug 18, 2015
1 parent f9a7758 commit 141302918403be8d38e9c4e5538bc546cc70c240
Showing with 29 additions and 20 deletions.
  1. +1 −1 config/config-exclude.coffee
  2. +2 −1 config/config-globs.coffee
  3. +26 −18 tasks/build/build-files.coffee
@@ -91,7 +91,7 @@ module.exports = (config, options) ->
index = _path.indexOf(v1.dir)
if index is 0
ext = path.extname _path
lang = if ext and ext.indexOf('*') is -1 then ext.substr 1 else null
lang = if ext and ext.indexOf('*') is -1 then ext.substr 1 else 'all'
lang = 'all' if allTypes.indexOf(k1) isnt -1
type = { type: k1, lang, path: "!#{_path}" }
break
@@ -195,7 +195,8 @@ module.exports = (config) ->
for own k2, v2 of v1
continue if not v2.length
continue if not excludes[k1]
ePaths = excludes[k1][k2]
ePaths = excludes[k1]['all']
ePaths = if ePaths then ePaths else excludes[k1][k2]
continue if not ePaths
continue if not ePaths.length
glob.src[appOrRb][loc][k1][k2] = v2.concat ePaths
@@ -17,7 +17,7 @@ module.exports = (gulp, config) ->

# task
# ====
runTask = (src, dest, file, files) ->
buildFile = (src, dest, file, files) ->
defer = q.defer()
gulp.src src
.pipe rename file
@@ -72,13 +72,11 @@ module.exports = (gulp, config) ->
data.client[type].push v

getFiles = (type, glob) ->
files = []
defer = q.defer()
# opts = read: false, buffer: false
# gulp.src glob, opts
# .on 'data', (file) ->
# files.push pathHelp.format file.path
gs.create(glob).on 'data', (file) ->
files = []
defer = q.defer()
opts = allowEmpty: true
stream = gs.create glob, opts
stream.on 'data', (file) ->
files.push pathHelp.format file.path
.on 'end', ->
addData type, files
@@ -98,11 +96,29 @@ module.exports = (gulp, config) ->
defer.promise

buildData = -> # async
defer = q.defer()
setGlobs()
q.all [
q.all([
getAllFiles 'styles', 'css'
getAllFiles 'scripts', 'js'
]).done -> defer.resolve()
defer.promise

# main task
# =========
runTask = -> # sync
defer = q.defer()
tasks = [
-> buildData()
-> buildFile(
config.templates.files.src.path
config.templates.files.dest.dir
config.templates.files.dest.file
format.json data
)
]
tasks.reduce(q.when, q()).done -> defer.resolve()
defer.promise

# task deps
# =========
@@ -111,14 +127,6 @@ module.exports = (gulp, config) ->
# register task
# =============
gulp.task "#{config.rb.prefix.task}build-files", taskDeps, ->
defer = q.defer()
buildData().done ->
runTask(
config.templates.files.src.path
config.templates.files.dest.dir
config.templates.files.dest.file
format.json data
).done -> defer.resolve()
defer.promise
runTask()


0 comments on commit 1413029

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