atticoos / gulp-ng-config

:wrench: Create AngularJS constants from a JSON config file
MIT License
173 stars 35 forks source link

Add a Coffeescript template #14

Open EdgarOrtegaRamirez opened 9 years ago

EdgarOrtegaRamirez commented 9 years ago

It would be great. :smile:

se-panfilov commented 9 years ago

@EdgarOrtegaRamirez I think, the better case for coffescript is to use js2coffee module (gulp-plugin, and online preview) instead:

var coffee = require('gulp-js2coffee');

gulp.task('js2coffee', function() {
gulp.src('configFile.json')
    .pipe(gulpNgConfig('myApp.config'))
    .pipe(js2coffee().on('error', gutil.log))
    .pipe(gulp.dest('./'))
});
atticoos commented 9 years ago

Clean solution by enforcing separation of concerns with that suggestion @se-panfilov :+1:

This'll be an additional usage to the README

devswert commented 8 years ago

Hi @se-panfilov your code has an error when you use js2coffee, the right form to use js2coffee with ng-config, at least this form works for me that I use gulp-angular-generator

var coffee = require('gulp-js2coffee');

gulp.task('create-env', function () {
  gulp.src(path.join(conf.paths.src, '/.env.json'))
    .pipe(gulpNgConfig('YourApp'))
    .pipe(coffee())
    .pipe(gulp.dest( path.join(conf.paths.src, '/') ))
});