roots / docs

📝 Documentation for Roots projects
https://roots.io/docs/
168 stars 183 forks source link

Adjust `add_editor_style` call to use relative path vs URI #467

Closed joshuafredrickson closed 1 year ago

joshuafredrickson commented 1 year ago

add_editor_style needs to receive the stylesheet as a relative path vs remote URI.

Additional context

retlehs commented 1 year ago

@joshuafredrickson I'm not able to reproduce needing to do this

  1. Add to setup.php:
add_action('after_setup_theme', function () {
    add_theme_support('editor-styles');
    add_editor_style(asset('app.css'));
});
  1. Add to app.css:

h1 {
  font-family:monospace;
  font-size: 6rem;
  line-height: 1;
  color: blue;
}
image

Are you not seeing this same result?

joshuafredrickson commented 1 year ago

Hey @retlehs ,

Your hunch about SSL was correct. Tested this out by toggling valet secure and valet unsecure a few times.

add_editor_style(asset('app.css'))

✅ Non-SSL ❌ SSL

asset

add_editor_style(asset('app.css')->relativePath(get_theme_file_path()))

✅ Non-SSL ✅ SSL

relativePath

I guess the question is now do we add both scenarios or use only the latter since it works both ways? I can rewrite as needed.

retlehs commented 1 year ago

No changes needed, thank you for the PR and for checking that 🙏