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)
- TypeScript Module `gulpfile.mts` Not Supported HOT 2
- `npm audit` vulnerability for `glob-parent` package
- Watchers do not detect specific files
- Curly braces in glob without commas do not work HOT 2
- unlink not work HOT 2
- Dependency unset-value has a Prototype Pollution vulnerability
- Upgrade Gupl-cli version to 2.3.0 HOT 1
- gulp.src *.123456 vs *.1234567
- error TS2305: Module '"gulp"' has no exported member 'parallel' HOT 2
- Atualizacao Gulp Util
- gulp does not work if base path has brackets [ ] HOT 1
- Bump glob-watcher to 6.0.0
- Update glob-version to lates major version HOT 1
- Error: Cannot find module 'gulp-cli' HOT 2
- Bun support HOT 2
- Gulp 4: How do I prevent from duplicated dependent task execution? #1392 HOT 1
- Request to provide a more beginner-friendly tutorial on gulp website. HOT 1
- CVE-2020-2869
- Audit Vulnerability , security Report for "glob-parent" Package in `gulp` package
- 这个项目还维护吗
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.