@cxco/dev-proxy
v0.3.0
Published
To help us develop our Virtual Assistants on the client website by proxying it.
Downloads
6
Readme
Dev-Proxy
To help us develop our Virtual Assistants on the client website by proxying it.
How do I get set up?
npm install @cxco/dev-proxy
Set up in your gulpfile:
const argv = require('yargs').argv;
const config = require('./gulp.config')();
const browserSync = require('browser-sync').create();
const cxProxyConfig = require('./cx-proxy.config');
const CxProxy = require('@cxco/dev-proxy').default;
// ... other gulp tasks and requires
// serve and watch files
gulp.task('watch', ['build'], async () => {
let port
let browserSyncConfig = {};
if (proxy) {
port = await (new CxProxy(cxProxyConfig)).start();
browserSyncConfig.proxy = `localhost:${port}`;
} else {
browserSyncConfig.server = {
baseDir: `./${config.build}`
}
}
browserSync.init(browserSyncConfig);
gulp.watch(config.watch, ['bs-reload']);
gulp.watch(config.scss, () => buildCss(true));
});
Configuration
To use the Dev-Proxy in your project you will also need a configuration file. You can use the cx-proxy.config.example
file to start with.
Publishing
Increment version with npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]
To publish this package to NPMJS.com run npm publish
with an authenticated user.