Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Live reload does not function (browser doesn't restart) #48

Open
CiscoKidxx opened this issue Aug 11, 2016 · 1 comment
Open

Live reload does not function (browser doesn't restart) #48

CiscoKidxx opened this issue Aug 11, 2016 · 1 comment

Comments

@CiscoKidxx
Copy link

CiscoKidxx commented Aug 11, 2016

Gulpfile.js

   var gulp = require('gulp'),
        mainBowerFiles = require('main-bower-files'),
        inject = require('gulp-inject'),
        server = require('gulp-express'),
        del = require('del');

    var paths = {
        temp: '.tmp',
        tempVendor: '.tmp/vendor',
        tempIndex: '.tmp/views/index.html',

        index: 'app/views/index.html',
        appSrc: ['app/**/*', '!app/views/index.html'],
        bowerSrc: 'bower_components/**/*'
    };

    gulp.task('default', ['watch']);

    gulp.task('watch', ['serve'], function () {
        gulp.watch(paths.appSrc, ['scripts']);
        gulp.watch(paths.bowerSrc, ['vendors']);
        gulp.watch(paths.index, ['copyAll']);
    });

    gulp.task('serve', ['copyAll'], function () {
        server.run(['prod.js']);
    });

    gulp.task('copyAll', function () {
        var vendorFiles = gulp.src(mainBowerFiles()).pipe(gulp.dest(paths.tempVendor));
        var appFiles = gulp.src(paths.appSrc).pipe(gulp.dest(paths.temp));

        return gulp.src(paths.index)
            .pipe(gulp.dest(paths.temp))
            .pipe(inject(appFiles, {
                relative: true
            }))
            .pipe(inject(vendorFiles, {
                relative: true,
                name: 'vendorInject'
            }))
            .pipe(gulp.dest(paths.temp));
    });

    gulp.task('vendors', function () {
        var tempVendors = gulp.src(mainBowerFiles()).pipe(gulp.dest(paths.tempVendor));

        return gulp.src(paths.tempIndex)
            .pipe(inject(tempVendors, {
                relative: true,
                name: 'vendorInject'
            }))
            .pipe(gulp.dest(paths.temp))
            .pipe(server.notify());
    });

    gulp.task('scripts', function () {
        var appFiles = gulp.src(paths.appSrc).pipe(gulp.dest(paths.temp));

        return gulp.src(paths.tempIndex)
            .pipe(inject(appFiles, {
                    relative: true
            }))
            .pipe(gulp.dest(paths.temp))
            .pipe(server.notify());
    });

    gulp.task('clean', function () {
        del([paths.temp]);
    });
@waltergms
Copy link

Same here.

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

No branches or pull requests

2 participants