A
A
Anton2017-10-01 01:41:09
gulp.js
Anton, 2017-10-01 01:41:09

Browser-sync how to set up a proxy?

The essence of the question is, I want to set up a proxy for the site, so as not to copy the entire html, but only to correct the styles.
Here is the task, there are no errors, but the site does not connect styles

var gulp   = require('gulp');
var server = require('browser-sync');
var util   = require('gulp-util');
var config = require('../config');

gulp.task('server', function() {
    server({
        proxy: 'https://www.samesite.com',
        files: [config.dest.css + '*.css'],
        middleware: require('serve-static')('./build'),
        rewriteRules: [
            {
                match: new RegExp('</head>'),
                fn: function() {
                    return '<script async src="/browser-sync/browser-sync-client.js?v=2.18.13"></script>' +
                        '<link rel="stylesheet" href="/css/main.css" media="all"></script></head >'
                }
            }
        ],
        port: 8080,
        open: true  
    });
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question