-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow watch of copy files. Fixes #33.
- Loading branch information
1 parent
bba66bf
commit 880aa82
Showing
11 changed files
with
319 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
yo | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
yo | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var logger = require('./service/logger'), | ||
gutil = require('gulp-util'), | ||
warnPrefix = gutil.colors.bgYellow.black('WARN'); | ||
|
||
function StreamBundlesUtil() { | ||
} | ||
|
||
StreamBundlesUtil.prototype.warnIfNoBundleProperty = function (config) { | ||
if (config && !config.bundle && config.file && config.file.relative) { // can guarantee !!file b/c (config instanceof Config) | ||
logger.log(warnPrefix, "No '" + gutil.colors.cyan('bundle') + | ||
"' property found in " + gutil.colors.magenta(config.file.relative) + ". Did you mean to define one?"); | ||
} | ||
}; | ||
|
||
// naturally a singleton because node's require caches the value assigned to module.exports | ||
module.exports = new StreamBundlesUtil(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var gulp = require('gulp'), | ||
gutil = require('gulp-util'), | ||
util = require('util'), | ||
path = require('path'), | ||
using = require('./using'), | ||
pathifySrc = require('./pathify-config-src'); | ||
|
||
function StreamCopy() { | ||
} | ||
|
||
// assume configBase will ALWAYS be defined (and defaulted to '.') | ||
StreamCopy.prototype.getCustomBase = function (configBase, relativeBase) { | ||
if (!relativeBase) { | ||
return configBase; | ||
} | ||
return path.join(configBase, relativeBase); | ||
}; | ||
|
||
/** | ||
* @param {String} item | ||
* @param base | ||
* @returns {*} | ||
*/ | ||
StreamCopy.prototype.getStringCopyStream = function (item, base) { | ||
return gulp.src(pathifySrc(item, base), { base: base }) | ||
.pipe(using.copy(base)); | ||
}; | ||
|
||
/** | ||
* @param {Object} item | ||
* @param base | ||
* @returns {*} | ||
*/ | ||
StreamCopy.prototype.getObjectCopyStream = function (item, base) { | ||
return gulp.src(pathifySrc(item.src, base), { base: this.getCustomBase(base, item.base) }) | ||
.pipe(using.copy(base)); | ||
}; | ||
|
||
StreamCopy.prototype.getCopyStream = function (item, base) { | ||
if (typeof item === 'string') { | ||
return this.getStringCopyStream(item, base); | ||
} else if (typeof item === 'object' && !util.isArray(item)) { | ||
return this.getObjectCopyStream(item, base); | ||
} | ||
this.throwUnsupportedSyntaxError(); | ||
}; | ||
|
||
StreamCopy.prototype.throwUnsupportedSyntaxError = function () { | ||
throw new gutil.PluginError('gulp-bundle-assets', 'Unsupported syntax for copy. See here for supported variations: ' + | ||
'https://github.com/chmontgomery/gulp-bundle-assets/blob/master/examples/copy/bundle.config.js'); | ||
}; | ||
|
||
// naturally a singleton because node's require caches the value assigned to module.exports | ||
module.exports = new StreamCopy(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.