Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3923068
D3600.id9313.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3600.id9313.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D3600: Adopt local tunnel
Attached
Detach File
Event Timeline
Log In to Comment