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

master: prefix paths in views.php #8546

Closed
mrclay opened this Issue Jun 21, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@mrclay
Member

mrclay commented Jun 21, 2015

Let's say we allow this in views.php:

  'prefix/' => __DIR__ . '/vendors/prefix/dist',

A few problems:

  1. We still have to scan dist to find view files. We no longer guess filenames at runtime (a good thing)
  2. If dist has subdirs, we could pull a lot more into views than we want.

Would it compromise this feature to limit scanning to the given directory? I.e. you might have to do this:

  'prefix/'        => __DIR__ . '/vendors/prefix/dist',
  'prefix/images/' => __DIR__ . '/vendors/prefix/dist/images',

@ewinslow

@ewinslow

This comment has been minimized.

Show comment
Hide comment
@ewinslow

ewinslow Jun 21, 2015

Member

Original motivation for prefixes was to be able to include the source of an entire AMD library like jquery or dojo into views very easily.

https://github.com/jquery/jquery/blob/master/src

I think not doing this recursively by default would make this use case significantly more painful.

If folks want to only include a single directory depth, they can just provide a custom callback as you have done. Php has some helpers for this like glob that make it not too painful.

Member

ewinslow commented Jun 21, 2015

Original motivation for prefixes was to be able to include the source of an entire AMD library like jquery or dojo into views very easily.

https://github.com/jquery/jquery/blob/master/src

I think not doing this recursively by default would make this use case significantly more painful.

If folks want to only include a single directory depth, they can just provide a custom callback as you have done. Php has some helpers for this like glob that make it not too painful.

mrclay added a commit to mrclay/Elgg-leaf that referenced this issue Jun 22, 2015

feature(views): Allow mapping views dirs via views.php files
views.php files can now map entire directory trees into the view system with
a desired prefix for the view name.

Fixes #8546
@mrclay

This comment has been minimized.

Show comment
Hide comment
@mrclay
Member

mrclay commented Jun 22, 2015

PR #8553

@mrclay

This comment has been minimized.

Show comment
Hide comment
@mrclay

mrclay Jun 22, 2015

Member

How about we also put the core _graphics dir back in place for better BC?

Member

mrclay commented Jun 22, 2015

How about we also put the core _graphics dir back in place for better BC?

mrclay added a commit to mrclay/Elgg-leaf that referenced this issue Jun 24, 2015

feature(views): Allow mapping views dirs via views.php files
views.php files can now map entire directory trees into the view system with
a desired prefix for the view name.

Fixes #8546
Fixes #8550

@ewinslow ewinslow closed this in #8553 Jun 24, 2015

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