Hi, 
I am trying to use gulp-inject to inject a js into a JSON file. but I am 
getting* Module name "gulp" has not been loaded yet for context: _. Use 
require([]) *error every time.

I installed the* npm install --save-dev gulp-inject *and*  npm install 
--save-dev gulp*

*Structure: *
*index.html*

<script data-main="js/main.js" type="application/x-javascript" 
src="lib/angular/upgrade/require.min.js"></script>

<script>
    require(['main'], function (main) {
        //gulp is now loaded.
        alert("gulp is loaded");
        require(['common']);
    });
</script>

*main.js:*
requirejs.config({
    baseUrl: "lib/angular/upgrade"
});
alert("in Main");


*common.js:*

var gulp = require(['gulp']);
var inject = require(['gulp-inject']);

gulp.src('js/configuration/files.json')
    .pipe(inject(gulp.src(['someFile.js'], {read: false}), {
        starttag: '"{{ext}}": [',
        endtag: ']',
        transform: function (filepath, file, i, length) {
            return '  "' + filepath + '"' + (i + 1 < length ? ',' : '');
        }
    }))
    .pipe(gulp.dest('./'));

I am missing something obviously but cant figure out where.. What else 
needs to be done to load the gulp module?

Thank You,
Bhavin

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to