Giter Site home page Giter Site logo

metalsmith-serve's People

Contributors

alexandervn avatar conceptualitis avatar danawoodman avatar eliotsykes avatar juhamust avatar mayo avatar woodyrew avatar zakhenry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

metalsmith-serve's Issues

Port 80

This may be totally silly, but I keep trying to serve to port 80 and when I do the app quits right away. I'm new to serving publicly, so this might just be me.

Thanks,

Ben

Usage with metalsmith-watch?

The readme recommends usage with metalsmith-watch, however when the watcher changes a file then metalsmith-serve tries to spawn a new server and crashes. The error output is this:

[metalsmith-serve] serving /projects/test/build at http://localhost:8082
Started watching **/*
articles/hello-world.md was changed
[metalsmith-serve] serving /projects/test/build at http://localhost:8082

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1042:14)
    at listen (net.js:1064:10)
    at net.js:1146:9
    at asyncCallback (dns.js:68:16)
    at Object.onanswer [as oncomplete] (dns.js:121:9)

And my configuration looks like this (the rest has been stripped for brevity):

var Metalsmith  = require('metalsmith'),
    serve       = require('metalsmith-serve'),
    watch       = require('metalsmith-watch');

Metalsmith(__dirname)
    .use(serve({
        port: 8082,
        verbose: true
    }))
    .use(watch())
    // ...
    .build(function(err) {
        if (err) { throw err; }
    });

I think this might be a bug in the code but I'm unsure of how to fix it. Any suggestions? 😄

v0.0.3 not working

running metalsmith-serve standalone with metalsmith

var Metalsmith = require('metalsmith'),
      serve = require('metalsmith-serve');

Metalsmith(__dirname)
    .use(serve())
    .build(function(err) {
      if (err) throw err;
    })

technically it 'serves' (the task runs) but browser returns 'not found'

maybe user error but seems pretty simple, not sure why it wouldn't work.

Logging?

Is there any way to write logs from metalsmith-serve to files? I have used the verbose option but haven't found a way to write the logs to files.

Allow for any host

There is currently no way to set host as null, as the default is localhost, and if you pass in null, it is overwritten by the default. Not assigning a host is useful if I want to do some quick internal testing on other devices, e.g. to have my iPhone hit my mac ip address to look at the site, but since the http server is only listening on localhost, it wont work, unless I get the IP address of my mac, and update the options to have it.

If you changed defaults.host = null, then it defaults to null, but still allows someone to set localhost if they desire.

No options passed in throws an error

I was trying to use the stock serve configuration:

...
.use(serve())
...

This basic config throws the following error:

/Users/marcelo/development/metalsmith-v2/node_modules/metalsmith-serve/lib/index.js:101
    if (!options[key]) {
                ^

TypeError: Cannot read property 'cache' of undefined
    at /Users/marcelo/development/metalsmith-v2/node_modules/metalsmith-serve/lib/index.js:101:17
    at Array.forEach (native)
    at plugin (/Users/marcelo/development/metalsmith-v2/node_modules/metalsmith-serve/lib/index.js:100:25)
    at Object.<anonymous> (/Users/marcelo/development/metalsmith-v2/metalsmith.js:37:8)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:430:10)
    at startup (node.js:141:18)
    at node.js:980:3

I'm on node v5.3.0.

I'm hoping this isn't just user error?

handle mime types

metalsmith-serve should be able to read mime-types from file meta and set the mimetype on the response header.

I was playing around with it here you can set the mimetype, but node-static just overwrites it. There's a closed issue about this on node-static. There's a number of other (open) issues on node-static re mimetypes. I don't think it's going to be resolved any time soon.

Take a look at this post on the slack channel, it kind of explains the context of what I'm trying to do.

So any ideas on how this might be fixed upstream ? I know it would be impractical to change dependencies for such a small feature, but there are other static servers that could easily resolve this.

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.