gulp-ng-constant icon indicating copy to clipboard operation
gulp-ng-constant copied to clipboard

Setting a custom filename for the outputted file via options?

Open nick13jaremek opened this issue 7 years ago • 2 comments

Hi there,

I am currently using the gulp-ng-constant module as follows:

ngConstants = require('gulp-ng-constant');

gulp.task('create-version-file', [], function () {
    var constants = { version: '1.0.0' };
    return ngConstant({
        constants: constants,
        wrap: false,
        deps: [],
        stream: true,
        name: 'myapp.version'
      })
        .pipe(gulp.dest('dist'))
});

However, doing so, creates an Angular constants file named ngConstants.js. Forcing a filename in gulp.dest by specifying a full path, as in gulp.dest('dist/version.js') creates a directory called version.js (which contains the generated ngConstants.js file) inside the dist directory.

No option seems to exist to specify the filename of the generated constants file. Is it so, or am I missing something in the docs?

Thanks in advance!

nick13jaremek avatar May 17 '17 14:05 nick13jaremek

Are you using v1.1? In v1, the name property only applies to the angular module name.

The readme in the master branch is for the preview version of v2.0.0-2, I apologize for the confusion.

guzart avatar May 20 '17 01:05 guzart

@nick13jaremek I ended up using gulp-rename to accomplish this. Just pipe it before the gulp.dest pipe.

johnnyflinn avatar Jul 24 '17 12:07 johnnyflinn