Page MenuHomeDevCentral

D3600.id9308.diff
No OneTemporary

D3600.id9308.diff

diff --git a/components/gulpfile.js b/components/gulpfile.js
--- a/components/gulpfile.js
+++ b/components/gulpfile.js
@@ -15,10 +15,11 @@
import autoprefixer from 'autoprefixer';
import imagemin from 'gulp-imagemin';
import { gifsicle, mozjpeg, optipng, svgo } from 'gulp-imagemin';
-
import * as dartSass from 'sass';
import gulpSass from 'gulp-sass';
+
const sass = gulpSass(dartSass);
+const localtunnel = require('localtunnel');
// Load all Gulp plugins into one variable
const $ = plugins();
@@ -151,13 +152,6 @@
.pipe(gulp.dest(config.paths.dist + '/assets/img'));
}
-// Start a server with BrowserSync to preview the site in
-function server(done) {
- browser.init({
- server: config.paths.dist, port: config.dev.port
- }, done);
-}
-
// Reload the browser with BrowserSync
function reload(done) {
browser.reload();
@@ -175,3 +169,34 @@
gulp.watch('src/assets/js/**/*.js').on('all', gulp.series(javascript, browser.reload));
gulp.watch('src/assets/img/**/*').on('all', gulp.series(images, browser.reload));
}
+
+// Start a server with BrowserSync to preview the site
+function server(done) {
+ browser.init({
+ server: config.paths.dist,
+ port: config.dev.port,
+ });
+ if (config.dev.tunnel) {
+ setupTunnel().then(() => {
+ done();
+ });
+ } else {
+ done();
+ }
+}
+
+// Function to set up the tunnel
+async function setupTunnel() {
+ try {
+ const tunnel = await localtunnel({ port: config.dev.port, subdomain: config.dev.subdomain });
+
+ console.log('Tunnel URL:', tunnel.url);
+
+ tunnel.on('close', () => {
+ console.log('Localtunnel closed');
+ });
+ } catch (err) {
+ console.error('Localtunnel setup failed:', err);
+ throw err;
+ }
+}
diff --git a/components/package-template.json b/components/package-template.json
--- a/components/package-template.json
+++ b/components/package-template.json
@@ -32,6 +32,7 @@
"gulp-uglify": "^3.0.2",
"js-yaml": "^4.1.0",
"js-yaml-js-types": "^1.0.1",
+ "localtunnel":"^2.0.2",
"panini": "^1.7.2",
"postcss": "^8.4.49",
"rimraf": "^6.0.1",
diff --git a/config.yml b/config.yml
--- a/config.yml
+++ b/config.yml
@@ -61,3 +61,5 @@
dev:
port: 8000
+ tunnel: true
+ subdomain: "project"
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -32,6 +32,7 @@
"gulp-uglify": "^3.0.2",
"js-yaml": "^4.1.0",
"js-yaml-js-types": "^1.0.1",
+ "localtunnel":"^2.0.2",
"panini": "^1.7.2",
"postcss": "^8.4.49",
"rimraf": "^6.0.1",

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 05:35 (21 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2310312
Default Alt Text
D3600.id9308.diff (2 KB)

Event Timeline