Skip to content

Commit

Permalink
useref-temp for symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
vietnogi committed Dec 9, 2015
1 parent 2831407 commit 07fbb34
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions tasks/serve.coffee
Expand Up @@ -92,6 +92,8 @@ module.exports = (gulp, $, configs) ->
gulp.watch(reloadFiles).on 'change', ->
$.browserSync.reload()

gulp.watch reloadFiles, ['useref-temp']

gulp.watch scssFiles, ['scss']
gulp.watch jadeFiles, ['template-cache']
gulp.watch coffeeFiles, ['coffee']
25 changes: 18 additions & 7 deletions tasks/useref.coffee
@@ -1,13 +1,15 @@
defaultFiles = '.tmp/index.html'
defaultDestPath = 'dist'
defaultSearchPath = ['.tmp', 'app', '.', 'src']
defaultFiles = '.tmp/index.html'
defaultDestPath = 'dist'
defaultDestTempPath = 'dist-temp'
defaultSearchPath = ['.tmp', 'app', '.', 'src']

module.exports = (gulp, $, configs) ->
files = configs.useref?.files || defaultFiles
destPath = configs.useref?.destPath || defaultDestPath
searchPath = configs.useref?.searchPath || defaultSearchPath
files = configs.useref?.files || defaultFiles
destPath = configs.useref?.destPath || defaultDestPath
destTempPath = configs.useref?.destTempPath || defaultDestTempPath
searchPath = configs.useref?.searchPath || defaultSearchPath

gulp.task 'useref', ->
useref = (destPath) ->
assetsOptions =
searchPath: searchPath

Expand All @@ -18,3 +20,12 @@ module.exports = (gulp, $, configs) ->
dest = gulp.dest destPath

src.pipe(assets).pipe(restore).pipe(useref).pipe dest

gulp.task 'useref', ->
useref destPath

# useref-temp is used for creating a folder that can be symlink
gulp.task 'useref-temp', ->
destPath = 'dist-temp'

useref destTempPath

0 comments on commit 07fbb34

Please sign in to comment.