Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFW: Livereload in development #2

Open
3 tasks
davegaeddert opened this issue Jun 15, 2018 · 6 comments
Open
3 tasks

RFW: Livereload in development #2

davegaeddert opened this issue Jun 15, 2018 · 6 comments
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed RFW Request for work

Comments

@davegaeddert
Copy link
Member

davegaeddert commented Jun 15, 2018

When using combine work, there should be a livereload feature.

The initial suggestion is to implement this using python-livereload. There is some potential for overlap between Combine's current implementation of "build steps" and livereload's ability to run commands. It is probably best to leave that alone, and instead just focus on whether the basic HTTP server can be replaced with a livereload server that simply focuses on reloading pages automatically:

combine/combine/dev.py

Lines 109 to 135 in 2fa299c

class Server:
def __init__(self, path, port=8000):
self.path = path
self.port = port
self.httpd = HTTPServer(self.path, ("", self.port))
def serve(self):
click.secho(f"Serving at http://127.0.0.1:{self.port}", fg="green")
self.httpd.serve_forever()
class HTTPHandler(SimpleHTTPRequestHandler):
"""This handler uses server.base_path instead of always using os.getcwd()"""
def translate_path(self, path):
path = SimpleHTTPRequestHandler.translate_path(self, path)
relpath = os.path.relpath(path, os.getcwd())
fullpath = os.path.join(self.server.base_path, relpath)
return fullpath
class HTTPServer(BaseHTTPServer):
"""The main server, you pass in base_path which is the path you want to serve requests from"""
def __init__(self, base_path, server_address, RequestHandlerClass=HTTPHandler):
self.base_path = base_path
BaseHTTPServer.__init__(self, server_address, RequestHandlerClass)

Requirements:

  • Livereload is enabled by default with combine work
  • Option to disable livereload with a CLI option
  • Option to specify the livereload port with a CLI option

(You don't have to work on the documentation -- we can do that part ourselves.)

General steps to get started:

  1. Fork this repo
  2. Run ./scripts/install
  3. poetry add livereload
  4. Run ./scripts/docs to test your changes on the Combine docs site
  5. Most of the work will be in dev.py, and the CLI options can be added in cli.py
  6. Make a branch and submit a pull request. Specific questions can be asked and answered on the PR.

This RFW is currently worth $150 and you'll be paid when we merge your PR. You can find more information and other RFWs on the Dropseed website.

Any questions can be asked here or through our private contact page!

@davegaeddert davegaeddert changed the title Livereload in development RFW: Livereload in development Jan 8, 2021
@davegaeddert davegaeddert added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers dependencies Pull requests that update a dependency file RFW Request for work labels Jan 8, 2021
@rohan-pednekar
Copy link

Hi @davegaeddert Can I take this ?

@davegaeddert
Copy link
Member Author

@rohan-pednekar go for it!

@rohan-pednekar
Copy link

Thanks @davegaeddert

@davegaeddert
Copy link
Member Author

Hey @rohan-pednekar -- just wanted to see if you're still planning to work on this or not?

@rohan-pednekar
Copy link

Hi @davegaeddert Sorry for the late response as I caught up in some personal work. Yes, I started working on it but, I am facing an issue while running the script on a Windows machine. I am looking into it and will update the same.

@davegaeddert
Copy link
Member Author

No problem — not trying to push, just curious if you were still planning on it or not!

Yeah the scripts might not work on Windows. If you find a simple way to make them compatible, that's fine, but if it's easier to just copy-paste the commands inside of them, that works too. Making all of the development stuff Windows-compatible isn't a super high priority for me right now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed RFW Request for work
Projects
None yet
Development

No branches or pull requests

2 participants