Closed turrsis closed 5 years ago
In times of "CSS pre-processor", "PostCSS" and Co. is this really needed?
With your view helper and MVC extension you introduce a new heavyweight:
zend-mvc
componentPlease have a look at this light-weight solution: #64
This looks great. However, I agree with @froschdesign that this may be a bit much to add directly to zend-view, due to the number of classes required; it's quite a bit of maintenance.
Might I suggest adding this as a separate repository/package instead? It could expose a ConfigProvider
and/or Module
class to ensure that the helper is wired when installed, and then have it's own development cycles separate from zend-view.
Thoughts?
This helper not require MVC extention, only Router. But Url
helper use router too.
I'm not entirely convinced of the necessity of the https://github.com/zendframework/zend-mvc/pull/216.
However, this PR can help to develop own cache, filter and other functionality.
There is a great analogue : https://github.com/RWOverdijk/AssetManager, but, to my mind, it too heavy for simple tasks. The idea here is approximately the same.
In my view, this PR will make the zend-view
more flexible.
I would suggest to look to replace (perhaps) the HeadLink
, HeadStyle
and HeadScript
this helper.
This helper not require MVC extention, only Router.
Your PR on the zend-mvc
says something different. 😉
There is a great analogue : https://github.com/RWOverdijk/AssetManager
Ah, there is the separate package.
I'm not against the idea, but I would prefer a solution which can be used in a zend-mvc
and a zend-expressive
application. (Or in a application which only uses zend-view
.)
Btw. this reminds me of the Drupal\Core\Asset
zend-mvc-PR
require zend-view-PR
, but zend-view-PR
not require zend-mvc-PR
. If this wrong - this is my mistake and I will fix it. This PR was planned as standalone of zend-mvc
.
Unfortunately, but I don't know anything about zend-expressive
.
Both PR were moved to the module https://github.com/turrsis/zend-view-assets. Can you review it?
@froschdesign, @weierophinney https://github.com/turrsis/zend-view-assets is refactored.
Mvc
folder should be moved to zend-mvc
and can be used for mvc applications.
Other classes depends on zend-view
, zend-cache
, zend-filter
and can be used for application which only uses zend-view
.
Using in zend-expressive
require additional PR for zend-expressive
module.
If this is acceptable to you - I will move Mvc
folder to https://github.com/zendframework/zend-mvc/pull/216.
@turrsis
Have you seen the new Asset
helper?
And do not forget the @weierophinney comment:
Might I suggest adding this as a separate repository/package instead? It could expose a ConfigProvider and/or Module class to ensure that the helper is wired when installed, and then have it's own development cycles separate from zend-view.
The separate repository is a very good suggestion. No need to add some classes under different repositories / packages.
@froschdesign, @weierophinney
Yes, I see https://docs.zendframework.com/zend-view/helpers/asset, but it only map resources and not allow use resources from modules.
turrsis/zend-view-assets
allow to use resources from modules, group and filter it.
"The separate repository is a very good suggestion" - I done it as separate repository, but mvc
part should be move from this. Where better to move it?
Can this module be included in the zendframework?
@turrsis
but it only map resources and not allow use resources from modules.
Right, but I see a problem here: two view helpers with the equal / similar name.
turrsis/zend-view-assets allow to use resources from modules, group and filter it.
The modules depending on zend-mvc. I can not use this with modules in zend-expressive. Right?
@froschdesign
Can be renamed to Resources
.
Mvc
dependency was moved to https://github.com/turrsis/zend-view-assets-mvc.
Now turrsis/zend-view-assets
is not depending on zend-mvc
and (to my mind) can be used with 'zend-expressive'.
Closing, as the third party module has been created as requested.
The
Assets
helper allow to add various resourses to html page, such as .css, .js, etc. It can be configure in config files. For page performance optimisation assets can be placed in top or bottom of page (or elsewhere).Allow to build several link by one alias:
Also can possible change layout decoration 'on fly' :