镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Assets are in vendor directory #2

Closed

Description

@weierophinney

This is not really an issue of this repository, other than it will require a documentation point in the README.md file: the debugbar creates links and script references to files that are in the vendor/ directory. Examples:

  • /vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css
  • /vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/highlightjs/styles/github.css
  • /vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.css
  • etc.

The issue with this is that for many applications, the web root is not the same as the project root, which means that the vendor/ directory is not directly accessible via the web.

There are a few ways to fix the situation.

First, you can symlink the vendor/ directory into your web root:

$ cd public
$ ln -s ../vendor .

This is not recommended, as it exposes library code via the web.

A better way is to copy just the assets into a directory of your web root, and pass that relative path to the call to getJavascriptRenderer(). As an example:

$ cd public
$ cp -a ../vendor/maximebf/debugbar/src/DebugBar/Resources phpdebugbar

The above copies the entire set of assets into a directory named phpdebugbar/ in your web root. From there, you only need to alter the line where you retrieve the JSON renderer:

$debugbarRenderer = $debugbar->getJavascriptRenderer('phpdebugbar');

Once you've done that, everything works correctly.

I'd recommend adding this documentation to the README.md file to help users understand how to incorporate the middleware in such applications.

Activity

  1. snapshotpl commented on Jan 7, 2016

    @snapshotpl
    Member

    @weierophinney You are absolutely right, however I have found better and simpler to use solution in #3 . Can you review this?

  2. snapshotpl commented on Jan 9, 2016

    @snapshotpl
    Member

    @weierophinney thanks for help. I have just release 1.1.0. I have also added factory to respository, so installation will be easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions