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

Specify reload path for browser #18

Closed
borkdude opened this issue May 31, 2015 · 7 comments
Closed

Specify reload path for browser #18

borkdude opened this issue May 31, 2015 · 7 comments

Comments

@borkdude
Copy link

@borkdude borkdude commented May 31, 2015

Disclaimer: first weekend trying to use boot, so forgive me if I'm asking an ignorant question.

I am using this boot project:

https://github.com/borkdude/lein2boot/

I have an http server (serve task) serving the files from the target directory.
My handler (animals.api/handler) serves files under the "public" directory.
When I change a clojurescript file, the browser tries to reload the file using "/public/" but then I get a 404. How do I get it to reload from "/" instead?

@borkdude borkdude changed the title Reload from non-root directory in target Specify reload path for browser May 31, 2015
@Deraen
Copy link
Contributor

@Deraen Deraen commented May 31, 2015

Instead of serving e.g. /css from public/css, serve /css from css.

This has been talked about a lot and the idea is that (in html) you should refer to the files using URL relative to your fileset, else we'll be in the same mess as Leiningen (you would manually set paths for each task).

borkdude added a commit to borkdude/lein2boot that referenced this issue May 31, 2015
@borkdude borkdude closed this May 31, 2015
@borkdude
Copy link
Author

@borkdude borkdude commented Jun 1, 2015

@Deraen I changed my setup and now reload works: https://github.com/borkdude/lein2boot/blob/master/build.boot

Now I have a different problem. My handler is serving all of my resources.
Is there any way I can have my public html/js/css in like "resources/public/js/foo.js" and have boot reload signal the browser to reload a file "/js/foo.js" and not "/public/js/foo.js"? I don't want to serve my whole resources folder...

@borkdude borkdude reopened this Jun 1, 2015
@Deraen
Copy link
Contributor

@Deraen Deraen commented Jun 1, 2015

We discussed about this in IRC and we came to agreement that boot-reload level :asset-path option would be suitable solution.

https://botbot.me/freenode/hoplon/2015-06-01/?msg=40678747&page=1

@borkdude
Copy link
Author

@borkdude borkdude commented Jun 1, 2015

@Deraen sounds good

@m9dfukc
Copy link

@m9dfukc m9dfukc commented Jun 9, 2015

Looks like my question at the hoplon discourse board seems kind related?!

@Deraen
Copy link
Contributor

@Deraen Deraen commented Jun 13, 2015

This is a bit more tricky than I initially thought. E.g. with cljs asset-path works so that it's prepended to any generated paths. Instead we have to remove the path from relative paths generated by Boot.

Deraen added a commit that referenced this issue Jun 13, 2015
Deraen added a commit that referenced this issue Jun 13, 2015
Removes specified path from the start of reloaded URL
@Deraen Deraen closed this in c6bbab5 Jun 14, 2015
Deraen added a commit that referenced this issue Jun 14, 2015
Asset :asset-path option, fixes #18
@borkdude
Copy link
Author

@borkdude borkdude commented Jun 14, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.