Created
January 19, 2021 04:06
-
-
Save codetot/283a8d5777e1a5f370a5179bdebf2a42 to your computer and use it in GitHub Desktop.
BrowserSync to detect localhost environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function codetot_is_localhost() { | |
return !empty($_SERVER['HTTP_X_CODETOT_HEADER']) && $_SERVER['HTTP_X_CODETOT_HEADER'] === 'development'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BrowserSyncConfig: { | |
host: 'localhost', | |
port: 3000, | |
proxy: { | |
target: 'http://ecom.test', | |
proxyReq: [ | |
proxyReq => { | |
proxyReq.setHeader('X-Codetot-Header', 'development') | |
} | |
] | |
}, | |
open: false, | |
files: [ | |
'**/*.php', | |
'assets/js/**/*.js', | |
'assets/css/**/*.css', | |
'assets/svg/**/*.svg', | |
'assets/img/**/*.{jpg,jpeg,png,gif}', | |
'assets/fonts/**/*.{eot,ttf,woff,woff2,svg}', | |
'src/**/*.css', | |
'src/**/*.js' | |
] | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment