Comments (13)
You can already use event-stream (or other libraries) to wrap existing node-style (callback) libraries. Not sure this belongs in core.
from gulp.
I agree that this just looks like event-stream and loses most of what makes
gulp awesome. Gulp can already deal with any type of streams but the
gulp.src & gulp.dest functions return streams that have a custom format
that is specific to gulp.
On Nov 30, 2013 1:24 PM, "Eric Schoffstall" [email protected]
wrote:
You can already use event-stream (or other libraries) to wrap existing
node-style (callback) libraries. Not sure this belongs in core.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/31#issuecomment-29560231
.
from gulp.
exactly, the point of these methods would be to convert the custom Stream data format:
{
shortened: 'foo.md',
base: 'doc/',
path: 'doc/foo.md',
isDirectory: false,
stat: { ... },
contents: <Buffer 23 20 63 ...>
}
into something that other tools would normally use (just the path
or contents
) + some config..
just cause in my opinion it will commit same mistakes as grunt eventually (many useful tools locked to a single runner for no real benefit).
from gulp.
Plugins aren't locked in. As long as you pass the expected format stream,
they would work anywhere. Grunt plugins won't work anywhere else. Please,
please, please look at both options more deeply before claiming they have
similar problems.
On Nov 30, 2013 1:40 PM, "Miller Medeiros" [email protected] wrote:
exactly, the point of these methods would be to convert the custom Stream
data format:{
shortened: 'foo.md',
base: 'doc/',
path: 'doc/foo.md',
isDirectory: false,
stat: { ... },
contents: <Buffer 23 20 63 ...>}into something that other tools would normally use (just the path or
contents) + some config..just cause in my opinion it will commit same mistakes as grunt eventually
(many useful tools locked to a single runner for no real benefit).—
Reply to this email directly or view it on GitHubhttps://github.com//issues/31#issuecomment-29560552
.
from gulp.
@phated this is just an advice on how you guys could convert other npm modules into a compatible format without having to write custom plugins (and would also simplify the code of current plugins).
from gulp.
@millermedeiros I like the idea but I think this belongs in userland. Core is reserved for base functionality not shims for supporting other styles of utilizing the base functionality.
from gulp.
Especially if we are thinking of splitting out the file format and standardizing it. The compat layer for that standard shouldn't be in gulp
from gulp.
just compare the plugin example on the README:
var es = require('event-stream');
module.exports = function(header){
// check our options
if (!header) throw new Error("header option missing");
// our map function
function modifyContents(file, cb){
// remember that contents is ALWAYS a buffer
file.contents = new Buffer(header + String(file.contents));
// first argument is an error if one exists
// second argument is the modified file object
cb(null, file);
}
// return a stream
return es.map(modifyContents);
}
with this implementation:
var gulpMapper = require('gulp-mapper');
module.exports = function(header){
return gulpMapper.mapFileContentsSync(prepend, header);
};
function prepend(fileContents, str){
if (!str) throw new Error("header option missing");
return new Buffer(str + String(fileContents));
}
think of it as a eventStream.map()
but for the stream format used by gulp. Could even be a generic method gulpMapper.map()
that receives the property name as first argument, like: gulpMapper.mapSync('stat', log)
(which would log all the file.stat
properties).
from gulp.
@millermedeiros Still the same opinion. IMO a function that makes writing plugins/streams easier doesn't need to be in core. It belongs in user-land and if proven useful enough in gulp-util
from gulp.
@contra sure, it can be on user land as a gulp-mapper
module. was more to share my thoughts on what I think could improve the project and reduce the amount of unnecessary plugins (even if it makes the build script a little bit uglier).
from gulp.
@millermedeiros let me know when you have a repo up I'd love to help out
from gulp.
@millermedeiros I just released a yeoman generator if you haven't started yet:
npm install -g generator-gulp-plugin
mkdir gulp-mapper
cd gulp-mapper
yo gulp-plugin
from gulp.
@hparra Nice! I'll try it out and give some feedback. I can put it in the README next to all of the plugin creation advice
from gulp.
Related Issues (20)
- Gulp v5.0.0 png and jpg images not opening after transferring via gulp HOT 2
- v5: after updating gulp to version 5, jpg and png files are not readable after src-dest processing HOT 7
- Option no-sort doesn't seem to work on gulp 5.0.0 HOT 5
- Gulp v5.0.0 does not work if the root folder contains too many files (Works in Gulp v4.0.2) HOT 1
- Static files broken HOT 2
- Simple gulp copy garbles font files HOT 10
- PNG files are corrupted after Gulp upgrade to 5.0 HOT 7
- v5: Stuck in infinite loop in some cases HOT 3
- Gulp.src/gulp.dest does not copy images or fonts correctly in [email protected] HOT 3
- Gulp v5 corrupt font files HOT 5
- not support node22 HOT 1
- gulp imagemin task is not working properly for the v5.0.0 gulp HOT 2
- Test fail on the latest version HOT 3
- `Unhandled 'error' event` error in gulp 5 HOT 3
- Corruption of image files during migration or optimization HOT 31
- (node:7504) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created)
- Upgrade from Gulp 4.0.2 to 5.0.0 with Node V20-LTS is missing bundled js files HOT 3
- TypeError: Unknown file extension ".ts" HOT 6
- src() doesn't work with wildcards (4.0.2 -> 5.0.0) HOT 6
- Pipeline errors are not properly handled in Gulp v5 HOT 1
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.