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 port to be set in the asset tags for theme previews. #295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/zendesk_apps_tools/theme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ def generate_payload
def inject_external_tags(head_template)
live_reload_script_tag = <<-html
<script type="text/javascript">
RACK_LIVERELOAD_PORT = 4567;
RACK_LIVERELOAD_PORT = #{options[:port]};
</script>
<script src="http://localhost:4567/__rack/livereload.js?host=localhost"></script>
<script src="http://localhost:#{options[:port]}/__rack/livereload.js?host=localhost"></script>
html

js_tag = <<-html
<script src="http://localhost:4567/guide/script.js"></script>
<script src="http://localhost:#{options[:port]}/guide/script.js"></script>
html

css_tag = <<-html
<link rel="stylesheet" type="text/css" href="http://localhost:4567/guide/style.css">
<link rel="stylesheet" type="text/css" href="http://localhost:#{options[:port]}/guide/style.css">
html

template = StringIO.new
Expand Down Expand Up @@ -141,7 +141,7 @@ def start_server(callbacks_after_upload)
server.set :livereload, options[:livereload]
server.set :callbacks_after_load, callbacks_after_upload
server.set :callback_map, {}
server.use Rack::LiveReload, live_reload_port: 4567 if options[:livereload]
server.use Rack::LiveReload, live_reload_port: options[:port] if options[:livereload]
server.run!
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/zendesk_apps_tools/theming/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def url_for(package_file)
relative_path = relative_path_for(package_file)
path_parts = recursive_pathname_split(relative_path)
path_parts.shift
"http://localhost:4567/guide/#{path_parts.join('/')}"
"http://localhost:#{options[:port]}/guide/#{path_parts.join('/')}"
end

def relative_path_for(filename)
Expand Down