Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(option): add option exclude.from.dist[client|server]
  • Loading branch information
jyounce committed Aug 18, 2015
1 parent f9a7758 commit 1413029
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config/config-exclude.coffee
Expand Up @@ -91,7 +91,7 @@ module.exports = (config, options) ->
index = _path.indexOf(v1.dir) index = _path.indexOf(v1.dir)
if index is 0 if index is 0
ext = path.extname _path 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 lang = 'all' if allTypes.indexOf(k1) isnt -1
type = { type: k1, lang, path: "!#{_path}" } type = { type: k1, lang, path: "!#{_path}" }
break break
Expand Down
3 changes: 2 additions & 1 deletion config/config-globs.coffee
Expand Up @@ -195,7 +195,8 @@ module.exports = (config) ->
for own k2, v2 of v1 for own k2, v2 of v1
continue if not v2.length continue if not v2.length
continue if not excludes[k1] 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
continue if not ePaths.length continue if not ePaths.length
glob.src[appOrRb][loc][k1][k2] = v2.concat ePaths glob.src[appOrRb][loc][k1][k2] = v2.concat ePaths
Expand Down
44 changes: 26 additions & 18 deletions tasks/build/build-files.coffee
Expand Up @@ -17,7 +17,7 @@ module.exports = (gulp, config) ->


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


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


buildData = -> # async buildData = -> # async
defer = q.defer()
setGlobs() setGlobs()
q.all [ q.all([
getAllFiles 'styles', 'css' getAllFiles 'styles', 'css'
getAllFiles 'scripts', 'js' 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 # task deps
# ========= # =========
Expand All @@ -111,14 +127,6 @@ module.exports = (gulp, config) ->
# register task # register task
# ============= # =============
gulp.task "#{config.rb.prefix.task}build-files", taskDeps, -> gulp.task "#{config.rb.prefix.task}build-files", taskDeps, ->
defer = q.defer() runTask()
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




0 comments on commit 1413029

Please sign in to comment.