Page MenuHomeDevCentral

D3600.id9313.diff
No OneTemporary

D3600.id9313.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,11 +152,20 @@
.pipe(gulp.dest(config.paths.dist + '/assets/img'));
}
-// Start a server with BrowserSync to preview the site in
+// Start a server with BrowserSync to preview the site
function server(done) {
browser.init({
- server: config.paths.dist, port: config.dev.port
- }, done);
+ server: config.paths.dist,
+ port: config.dev.port,
+ });
+
+ if (tunnel in config.dev && config.dev.tunnel.enabled) {
+ setupTunnel().then(() => {
+ done();
+ });
+ } else {
+ done();
+ }
}
// Reload the browser with BrowserSync
@@ -175,3 +185,23 @@
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));
}
+
+async function setupTunnel() {
+ try {
+ const tunnelOptions = { port: config.dev.port };
+
+ if (subdomain in config.dev.tunnel) {
+ tunnelOptions.subdomain = config.dev.tunnel.subdomain;
+ }
+ const tunnel = await localtunnel(tunnelOptions);
+
+ 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,6 @@
dev:
port: 8000
+ tunnel:
+ enabled: true
+ subdomain: "upsection"
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",
diff --git a/tests/site/.gitkeep b/tests/site/.gitkeep
deleted file mode 100644

File Metadata

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

Event Timeline