Comments (3)
You should be able to create two streams merge them and then sync
Sent from my iPhone
On 4 juin 2015, at 08:22, James F McMahon [email protected] wrote:
It is possible to upload both gzipped and non-gzipped files in a single task?
Currently I have the following:
var gulp = require("gulp");
var awspublish = require('gulp-awspublish');
var rename = require("gulp-rename");var publisher = awspublish.create({
params: {
Bucket: 'test-bucket'
}
});function prefixFile(path) {
path.dirname = '/foo/' + path.dirname;
}gulp.task('s3:gzip', function() {
return gulp.src('public/*/')
.pipe(rename(prefixFile))
.pipe(awspublish.gzip({ ext: '.gz' }))
.pipe(publisher.cache())
.pipe(publisher.publish())
.pipe(awspublish.reporter());
});gulp.task('s3:plain', function() {
return gulp.src('public/*/')
.pipe(rename(prefixFile))
.pipe(publisher.cache())
.pipe(publisher.publish())
.pipe(awspublish.reporter());
});But if I try to add sync to either or these tasks they delete each other's files. Is it possible to do this is in single task so that sync respects that both versions of the file should be uploaded?
—
Reply to this email directly or view it on GitHub.
from gulp-awspublish.
Ah, thanks for the tip, this is what I ended up doing:
var gulp = require("gulp");
var awspublish = require('gulp-awspublish');
var rename = require("gulp-rename");
var merge = require('merge-stream');
var publisher = awspublish.create({
params: {
Bucket: 'test-bucket'
}
});
function prefixFile(path) {
path.dirname = '/foo/' + path.dirname;
}
gulp.task('s3', function() {
var gzipFilter = [
'public/**/*.js', 'public/**/*.html',
'public/**/*.css', 'public/**/*.xml',
'public/**/*.txt', 'public/**/*.ico',
'public/**/*.json',
];
var negativeFilter = gzipFilter.map(function(x) {
return '!' + x;
});
var gzip = gulp.src(gzipFilter)
.pipe(rename(prefixFile))
.pipe(awspublish.gzip());
var plain = gulp.src(['public/**/*'].concat(negativeFilter))
.pipe(rename(prefixFile));
return merge(gzip, plain)
.pipe(publisher.cache())
.pipe(publisher.publish())
.pipe(publisher.sync())
.pipe(awspublish.reporter());
});
Think something like this is worth adding to the examples? I can create a PR when I get a chance.
from gulp-awspublish.
yep but maybe just specify the part not specific to your app so just keep
var gzip = gulp.src(zipfiles)
.pipe(awspublish.gzip());
var plain = gulp.src(plainFiles)
return merge(gzip, plain)
.pipe(publisher.cache())
.pipe(publisher.publish())
.pipe(publisher.sync())
.pipe(awspublish.reporter());
On Thu, Jun 4, 2015 at 11:52 AM, James F McMahon [email protected]
wrote:
Ah, thanks for the tip, this is what I ended up doing:
var gulp = require("gulp");var awspublish = require('gulp-awspublish');var rename = require("gulp-rename");var merge = require('merge-stream');
var publisher = awspublish.create({
params: {
Bucket: 'test-bucket'
}
});
function prefixFile(path) {
path.dirname = '/foo/' + path.dirname;
}gulp.task('s3', function() {
var gzipFilter = [
'public//*.js', 'public//.html',
'public/__/.css', 'public//*.xml',
'public//.txt', 'public/__/.ico',
'public/*/.json',
];
var negativeFilter = gzipFilter.map(function(x) {
return '!' + x;
});var gzip = gulp.src(gzipFilter) .pipe(rename(prefixFile)) .pipe(awspublish.gzip()); var plain = gulp.src(['public/**/*'].concat(negativeFilter)) .pipe(rename(prefixFile)); return merge(gzip, plain) .pipe(publisher.cache()) .pipe(publisher.publish()) .pipe(publisher.sync()) .pipe(awspublish.reporter());
});
Think something like this is worth adding to the examples? I can create a
PR when I get a chance.—
Reply to this email directly or view it on GitHub
#65 (comment)
.
PG
from gulp-awspublish.
Related Issues (20)
- CredentialsError: Missing credentials in config HOT 2
- How can I use option s3.path? HOT 1
- Some Malformed Assets - Fonts & Images
- Parallelize ignores `force` flag in options for publisher
- README is a lie re: IAM credentials. HOT 2
- Replace deprecated dependency gulp-util
- "InvalidParameterType: Expected params.ContentType to be a string" error after updating to 3.3.2 HOT 2
- TypeError: Cannot read property 'path' of undefined HOT 3
- Can I disable gzipped logs? HOT 5
- what is "cacheFileName", "Cache-Control" where can I find doumentation on this? HOT 1
- FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory HOT 3
- Setup Travis CI HOT 3
- AccessDenied - Non-Public S3 Breaks gulp-awspublish HOT 1
- Sync does not allow the deletion of more than 1000 keys/files HOT 3
- Why does it require "public" access to a bucket? HOT 2
- Way to only apply headers to files in a certain folder? HOT 1
- sync mark expires instead of deleting now
- Migrate to @aws-sdk/client-s3 HOT 1
- through2 still used in lib/log-reporter.js, but removed from package.json HOT 4
- Publishing finishes with async with no result
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-awspublish.