Comments (12)
@nelsonomuto fyi, a recent change in lite-server 2.2.0
now allows you to require('lite-server');
from your gulpfile and use its API instead of having to go through exec
. This offers some additional flexibility for those who might want to get a reference to browsersync itself from lite-server (additional watchers, events, etc.) or may need to wait until browsersync has initialized via a callback.
https://github.com/johnpapa/lite-server/blob/master/package.json#L5
https://github.com/johnpapa/lite-server/blob/master/index.js
from lite-server.
@kkasaei just use browsersync directly with gulp. lite-server
is a small configuration wrapper around browsersync
and isn't meant for gulp integration. Copy lite-server's configuration and use with your browsersync config in your custom gulp file.
from lite-server.
lite-server is meant to get you started. it helps those who want to write angular and not worry about a node server, until they have time to create the server they want. node, asp.net, java, whatever.
once you decide to write server code, it is time to put lite-server aside and use a real server.
from lite-server.
@kkasaei here is an example of using gulp and lite server for your reference: https://github.com/nelsonomuto/lite-server-gulp
from lite-server.
@t3dodson I was able to start the lite-server from my gulpscript as follows:
const gulp = require("gulp");
const lite = require("lite-server");
const BS_CONFIG_FILE = "config/lite-server/bs-config.json";
gulp.task("start:dev:serve", () => {
lite.server({ argv: ["", "", "-c", BS_CONFIG_FILE]}, () =>
{
console.log("Lite-server running..")
});
});
Defining the argv property is not very nice. I'm not sure if there is a better possibility.
from lite-server.
you can still easily integrate gulp with lite-server and leverage less by having a gulp watch on the css file @johnpapa. This way you can take advantage of the browser-sync you get out of the box with lite server.
Just thought it would be worth it to call out, it only added 3 lines of code to my gulpfile to execute lite server as a child process.
Here is my gulpfile
Good job by the way, lite server is a great tool.
from lite-server.
@kkasaei Why do you need gulp interaction? lite-server is a simple webserver that you start and it does its thing.
from lite-server.
@mikeerickson , My concern is about testing. so lets say with browser-sync and gulp you define a task like this:
gulp.task('serve-specs', function() {
browserSync.init({
notify: false,
port: 8081,
server: {
baseDir: ["test", "app"],
routes: {
'/bower_components': 'bower_components'
}
}
});
gulp.watch(['app/**/*.*'])
.on('change', browserSync.reload);
});
So how should I approach the same thing with lite-server?
cheers
from lite-server.
@cgmartin Thanks. I'll check it and get back to you.
from lite-server.
we would use gulp to transpile our less files for example
from lite-server.
good point @nelsonomuto :)
from lite-server.
@cgmartin Is there any docs available on how one would start to integrate gulp with lite-server?
from lite-server.
Related Issues (20)
- Installation fails E429 too many Requests HOT 1
- Not listening on this port
- npm audit found vulnerabilities HOT 1
- npm is not started started script missing HOT 1
- i m trying to run npm start command but it is giving following error
- Problem with npm install HOT 2
- unable to start lite-server on wsl2 HOT 1
- Error using lite-server for create-react-app HOT 3
- The package needs to update axios to solve high severity vulnerability HOT 1
- Disable SPA handling? HOT 1
- lite-server doesn't trigger or reload the page when I save the page after adding something .
- CORS 404 OPTIONS HOT 2
- How to get Directory Listing working?
- Trying to start an html website using NPM and Lite-server HOT 2
- lite-server not installing using (npm install lite-server -g) HOT 1
- Lite-server dependecies are vulnerable (The Async package have a vulnerability)
- lite-server generating three Uncaught (in promise) errors after each reload
- Lite server disables CDN links
- Static files and api proxy HOT 1
- npm & github recommend not using: "All versions of package lite-server are vulnerable to Denial of Service"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lite-server.