gulp-ng-constant
gulp-ng-constant copied to clipboard
Setting a custom filename for the outputted file via options?
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!
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.
@nick13jaremek I ended up using gulp-rename to accomplish this. Just pipe it before the gulp.dest pipe.