-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for no json file (and only inline values from gulp) #16
Comments
Nope, feel free |
i haven't either. |
You can achieve this using buffer-to-vinyl. var b2v = require('buffer-to-vinyl');
var gulpNgConfig = require('gulp-ng-config');
gulp.task('make-config', function() {
var json = JSON.stringify({
// your config here
});
return b2v.stream(new Buffer(json), 'config.js')
.pipe(gulpNgConfig('app.config'))
.pipe(gulp.dest('build'));
}); Is this worth putting in the readme? I can whip up a PR. |
@psalaets great call, one of the beautiful things about streams is that we can & should be extremely modular and allow for single responsibility -- piping the result of that into |
Started 'Additional Usages' section with example for issue #16
that works, but it seems a little weird to me to require an extra module to read what you already have in code. It seems more logical to me to require something extra to read configs from a file (and default to only inline objects), though since it's already implemented this way, might not be worth changing. |
When it comes to the principles behind a stream build system, a gulp plugin only serves as a stage (pipe) of the stream. To build around edges where there might not be a source of a stream, it kind of defeats the purpose of how a gulp plugin is intended to work -- there needs to be a stream source. The source, in this case, should be responsible for taking your command line args, creating your JSON object, and beginning a new readable stream. |
Think I'm going to take a look at this for |
the use case i'm thinking of is pass a command line param to gulp and pass that directly to the plugin
this would be especially nice since it allows you to avoid putting the value of your constants in source control, which is what drew me to this in the first place.
my workaround for the time being will be to create a json file that is just {}
The text was updated successfully, but these errors were encountered: