GithubHelp home page GithubHelp logo

lite-server & gulp about lite-server HOT 12 CLOSED

johnpapa avatar johnpapa commented on August 20, 2024
lite-server & gulp

from lite-server.

Comments (12)

cgmartin avatar cgmartin commented on August 20, 2024 3

@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.

cgmartin avatar cgmartin commented on August 20, 2024 2

@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.

johnpapa avatar johnpapa commented on August 20, 2024 2

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.

nelsonomuto avatar nelsonomuto commented on August 20, 2024 2

@kkasaei here is an example of using gulp and lite server for your reference: https://github.com/nelsonomuto/lite-server-gulp

from lite-server.

MarkusTischendorf avatar MarkusTischendorf commented on August 20, 2024 2

@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.

nelsonomuto avatar nelsonomuto commented on August 20, 2024 1

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.

mikeerickson avatar mikeerickson commented on August 20, 2024

@kkasaei Why do you need gulp interaction? lite-server is a simple webserver that you start and it does its thing.

More information here

from lite-server.

kkasaei avatar kkasaei commented on August 20, 2024

@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.

kkasaei avatar kkasaei commented on August 20, 2024

@cgmartin Thanks. I'll check it and get back to you.

from lite-server.

nelsonomuto avatar nelsonomuto commented on August 20, 2024

we would use gulp to transpile our less files for example

from lite-server.

johnpapa avatar johnpapa commented on August 20, 2024

good point @nelsonomuto :)

from lite-server.

t3dodson avatar t3dodson commented on August 20, 2024

@cgmartin Is there any docs available on how one would start to integrate gulp with lite-server?

from lite-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.