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

Allow configuration for pathname in addition to host and port #67

Open
lheberlie opened this issue Jul 14, 2017 · 2 comments
Open

Allow configuration for pathname in addition to host and port #67

lheberlie opened this issue Jul 14, 2017 · 2 comments

Comments

@lheberlie
Copy link
Contributor

lheberlie commented Jul 14, 2017

Hey Pat,

Request:

It would be helpful to allow for configuration while running acetate in server/watch mode to have a pathname in addition to host and port.

Description:

When normally running acetate in server/watch mode the dev server will launch with http://localhost:3000/ where content is served from the build output folder configuration.

It would be helpful to have a configuration option where the build output folder configuration is served from http://localhost:3000/foo/bar and all page metadata would remain available.

Justification

This will help with content creators who are not familiar with the acetate build system to author relative links correctly in markdown (md) pages. Often content creators will go up too far in the relative directory tree [foo](../../../folder/index.html) which works fine when hosted from http://localhost:3000 but after deployment the link is broken.

Contact me if this does not accurately describe the issue.

--Lloyd

cc: @bsvensson

@patrickarlt
Copy link
Owner

@lheberlie Since browsersync doesn't support an option like this https://www.browsersync.io/docs/options and I'm not really sure why they would, I've implimented this in the following way:

  1. In [email protected], acetate.load(pattern) now accepts an additional options object, acetate.load(pattern, options).
  2. One of those options is a basePath which will be prepend to all page url and dest properties.

So:

acetate.load('**/*.+(html|md)', {
  basePath: 'javascript/latest' // no leading or trailing slashes
})

would now mean that all files matching **/*.+(html|md) will now be output to build/javascript/latest and their URLs will be served accordingly so the dev server will serve the site under /javascript/latest/.

This does have implications for relativeUrl thought. Since relativeUrl is the relative path back to the root of the build folder if you use { basePath: 'javascript/latest' } your relative URL from index.htmlwill now be ../../ instead of ``. To me this is expected behavior but it would be easily worked around with a transformer.

This is part of [email protected] which we are currently testing on the developers site but I hope to have a stable release soon.

@jgravois
Copy link
Contributor

jgravois commented Sep 28, 2018

we've had success with the basePath option developing https://esri.github.io/arcgis-rest-js/

#74 would make it possible to launch the browser to display the nested folder using CLI and close the loop on @lheberlie's request too (i think).

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

No branches or pull requests

3 participants