Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Vinyl adapter option #9

Merged
merged 1 commit into from
Feb 3, 2015
Merged

Vinyl adapter option #9

merged 1 commit into from
Feb 3, 2015

Conversation

lukehorvat
Copy link
Contributor

It seems to me that this gulp plugin should be completely usable without a physical file to source the constants from, because you can pass an object via the constants option. But the current setup doesn't really allow it.

I've added a noFile option that allows the plugin to act as a vinyl adapter, meaning it can be used in place of gulp.src. For example:

var gulp = require('gulp');
var ngConstant = require('gulp-ng-constant');
var uglify = require('gulp-uglify');
var constants = { hello: 'world' };

gulp.task('config', function () {
  return ngConstant({name: 'my.module.config', constants: constants, noFile: true})
    .pipe(uglify())  
    .pipe(gulp.dest('dist'));
});

The default outputted filename will be constants.js.

@guzart
Copy link
Owner

guzart commented Nov 7, 2014

This is a great idea, and you are right, this is a potential use for the plugin.

It would be way better if we could automatically detect the use case, I would like the plugin to act smart but allow you to force the functionality with an option.

@andidev
Copy link
Contributor

andidev commented Jan 24, 2015

@guzart Any news on this?

@andidev
Copy link
Contributor

andidev commented Jan 28, 2015

For those who need this right away I have implemented this in https://www.npmjs.com/package/gulp-ng-constant-fork

guzart added a commit that referenced this pull request Feb 3, 2015
feat(stream): add stream option
@guzart guzart merged commit 481c8b7 into guzart:master Feb 3, 2015
@guzart
Copy link
Owner

guzart commented Feb 3, 2015

@lukehorvat thank you for the PR, out in the wild on 0.3.0

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants