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

Assets are in vendor directory #2

Closed
weierophinney opened this issue Jan 6, 2016 · 2 comments
Closed

Assets are in vendor directory #2

weierophinney opened this issue Jan 6, 2016 · 2 comments

Comments

@weierophinney
Copy link
Contributor

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.

@snapshotpl
Copy link
Member

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

@snapshotpl
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants