Comments (10)
I'm thinking that gulp.src
could be maybe 4 modules:
- one that converts the globs into a Stream of files that only contains the paths (no content or stats).
- a
filereader-stream
that adds thecontent
to the paths info. - a
filestats-stream
that adds thestats
to the paths info. - one that encapsulates all of them for brevity.
and gulp.dest
could be just a filewriter-stream
that simply does mkdirp
and fs.createWriteStream
based on the file.path
and file.content
.
I've been looking for a good API to read files from multiple directories, and process them before copying to a destination for a long time. This might be the one, since it allows piping multiple transforms in a easy way.
from gulp.
Rambling a bit here...
@millermedeiros I can merge the file format into the output of glob-stream (the path info, not contents). The filestats streams takes this and attaches the stats object. The filereader stream takes this and based on X args (buffer: true, read: false, etc.) and the file.stats creates file.contents. The fileread needs filestats to be executed on the file object otherwise it won't know how to read directories correctly.
Is this what you're suggesting? Thoughts?
from gulp.
It was just an idea, did not put too much thought into that. In fact not
even sure what would be the best format and if the "plugins" should expose
just an async method...
from gulp.
Gulp isn't too big, and the file streams could be used without the task management. I see no reason for the decouple.
from gulp.
@phated the problem is not the "size" of gulp, but that at the moment this tool have 4 different responsibilities which are not necessarily closely related:
- it's a task runner (delegates work to
orchestrator
) - it's a file watcher (delegates work to
gaze
) - it's an argument parser (delegates work to
optimist
) - it's a file processor based on Streams (currently implemented internally)
since responsibilities 1, 2 and 3 are handled by external tools, I think this should also be part of an external package and gulp would just glue the external tools together and provide an unified API (maybe not even necessary). - I don't need that many unrelated dependencies (arguments parser, file watcher and task runner) just to process files.
this is not a problem of file size, but just that smaller tools with single responsibilities are easier to grok and can evolve independently (size of the README would reduce considerably). I would really like to see a future where we can reuse modules without having to code yet another plugin for a different runner... and Streams are a good abstraction for some file operations because they can be piped and doesn't require whole file to be in memory (even tho most examples I saw doesn't benefit from that).
from gulp.
Instead, you are advocating for yet another file streaming style. This
style is unique to gulp and doesn't really matter standalone. Gulp doesn't
require plugins, just JS, which is where most of your confusion seems to be
coming from. The reason to make a plugin is to tell people it expects that
style of file stream.
On Nov 30, 2013 11:40 AM, "Miller Medeiros" [email protected]
wrote:
@phated https://github.com/phated the problem is not the "size" of
gulp, but that at the moment this tool have 4 different responsibilities
which are not necessarily closely related:
- it's a task runner (delegates work to orchestrator)
- it's a file watcher (delegates work to gaze)
- it's an argument parser (delegates work to optimist)
- it's a file processor based on Streams (currently implemented
internally)since responsibilities 1, 2 and 3 are handled by external tools, I think
this should also be part of an external package and gulp would just
glue the external tools together and provide an unified API (maybe not
even necessary). - I don't need that many unrelated dependencies (arguments
parser, file watcher and task runner) just to process files.this is not a problem of file size, but just that smaller tools with
single responsibilities are easier to grok and can evolve independently
(size of the README would reduce considerably). I would really like to see
a future where we can reuse modules without having to code yet another
plugin for a different runner... and Streams are a good abstraction for
some file operations because they can be piped and doesn't require
whole file to be in memory (even tho most examples I saw doesn't benefit
from that).—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-29558195
.
from gulp.
@phated I'm advocating a standalone file stream standard (same as what you guys currently have), in the hopes of it becoming widely used in different contexts, and that users understands the benefits of Streams over regular callbacks for some tasks... I'll elaborate better about plugins on a separate issue. - xkcd on standards
from gulp.
Okay so I broke the file object out into https://github.com/wearefractal/vinyl and I'm breaking the read/write for the FS into vinyl out into https://github.com/wearefractal/vinyl-fs
from gulp.
+1. vinyl-fs
actually allows most gulp plugins to be used anywhere, e.g. inside grunt tasks.
from gulp.
Closing this - vinyl-fs is coming in the next release
from gulp.
Related Issues (20)
- 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
- 这个项目还维护吗
- Still using [email protected], which still uses [email protected] HOT 3
- gulp.dest() wrong path if foldername contains "*"
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.