Skip to content

Commit 7f81e67

Browse files
committed
feat(serve): add serve-export task
1 parent cf2d031 commit 7f81e67

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

skeleton-es2016/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ A gulp task is already configured for that. Use the following command to export
180180
gulp export
181181
```
182182
The app will be exported into ```export``` directory preserving the directory structure.
183+
184+
To start the exported app, execute the following command:
185+
186+
```shell
187+
gulp serve-export
188+
```
189+
183190
#### Configuration
184191
The configuration is done by ```bundles.js``` file.
185192
In addition, ```export.js``` file is available for including individual files.

skeleton-es2016/build/tasks/serve.js

+18
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,21 @@ gulp.task('serve-bundle', ['bundle'], function(done) {
3636
}
3737
}, done);
3838
});
39+
40+
// this task utilizes the browsersync plugin
41+
// to create a dev server instance
42+
// at http://localhost:9000
43+
gulp.task('serve-export', ['export'], function(done) {
44+
browserSync({
45+
online: false,
46+
open: false,
47+
port: 9000,
48+
server: {
49+
baseDir: ['./export'],
50+
middleware: function(req, res, next) {
51+
res.setHeader('Access-Control-Allow-Origin', '*');
52+
next();
53+
}
54+
}
55+
}, done);
56+
});

skeleton-typescript/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ A gulp task is already configured for that. Use the following command to export
180180
gulp export
181181
```
182182
The app will be exported into ```export``` directory preserving the directory structure.
183+
184+
To start the exported app, execute the following command:
185+
186+
```shell
187+
gulp serve-export
188+
```
189+
183190
#### Configuration
184191
The configuration is done by ```bundles.js``` file.
185192
In addition, ```export.js``` file is available for including individual files.

skeleton-typescript/build/tasks/serve.js

+18
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,21 @@ gulp.task('serve-bundle', ['bundle'], function(done) {
3636
}
3737
}, done);
3838
});
39+
40+
// this task utilizes the browsersync plugin
41+
// to create a dev server instance
42+
// at http://localhost:9000
43+
gulp.task('serve-export', ['export'], function(done) {
44+
browserSync({
45+
online: false,
46+
open: false,
47+
port: 9000,
48+
server: {
49+
baseDir: ['./export'],
50+
middleware: function(req, res, next) {
51+
res.setHeader('Access-Control-Allow-Origin', '*');
52+
next();
53+
}
54+
}
55+
}, done);
56+
});

0 commit comments

Comments
 (0)