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

Setting absolute Path in Phalcon\Assets\Resource::setTargetUri() #1157

Closed
ralusnom opened this issue Aug 26, 2013 · 6 comments
Closed

Setting absolute Path in Phalcon\Assets\Resource::setTargetUri() #1157

ralusnom opened this issue Aug 26, 2013 · 6 comments
Labels
stale Stale issue - automatically closed

Comments

@ralusnom
Copy link

As mentioned here before:

There's no possibility to set a absolute uri ( Phalcon\Assets\Resource::setTargetUri() ), when using the compressor filters and a different static server.

Set:

$this->assets->setTargetUri('http://static.otherserver.com/js/final.js')

Result:

<script src="/http://static.otherserver.com/js/final.js" type="text/javascript"></script>

It is more obviously when you set up an absolute baseUri in bootstrap.

Then you'll get SLT:

<script src="http://www.mything.com/http://static.otherserver.com/js/final.js" type="text/javascript"></script>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@phalcon
Copy link
Collaborator

phalcon commented Aug 26, 2013

When adding the resource to the collection you need to set it as non-local:

$this->assets->addJs('http://static.otherserver.com/js/final.js', false);

@ovr
Copy link
Contributor

ovr commented Aug 28, 2013

@phalcon see disc on forum
example

<?php
    $this->assets
        ->collection('application')

        ->addJs('src/app/models/Cart.js')
        ->addJs('src/app/models/Metric.js')
        ->addJs('src/app/models/Product.js')
        ->addJs('src/app/models/Shop.js')
        ->addJs('src/app/models/User.js')

        ->addJs('src/app/views/product/index/view/Shop.js')
        ->addJs('src/app/views/product/index/view/CollectionModal.js')
        ->addJs('src/app/views/components/CommentsAlert.js')
        ->addJs('src/app/views/components/Modal.js')

        ->addJs('src/app/views/blocks/Collection.js')
        ->addJs('src/app/views/blocks/Comments.js')
        ->addJs('src/app/views/blocks/FollowButton.js')
        ->addJs('src/app/views/blocks/User.js')
        ->addJs('src/app/views/blocks/Product.js')

        ->addJs('src/app/views/user/feed/Collections.js')
        ->addJs('src/app/views/user/feed/Events.js')
        ->addJs('src/app/views/user/feed/Followers.js')
        ->addJs('src/app/views/user/Feed.js')

        ->addJs('src/app/views/Layout.js')
        ->addJs('src/app.js')

        ->addJs('js/animate.js')

        ->join(true)

        ->addFilter(new Phalcon\Assets\Filters\Jsmin())

        ->setTargetPath(APPLICATION_PATH . '/../public/js/application.js')
        ->setTargetUri('http://static.site.domain/js/application.js');
?>

@phalcon
Copy link
Collaborator

phalcon commented Aug 28, 2013

But, setTargetUri is intended to pass an URI (Uniform Resource Identifier) as parameter not a URL (Uniform Resource Locator) as parameter

@ovr
Copy link
Contributor

ovr commented Aug 29, 2013

@phalcon okey. buy how can i set url? this class havn`t method setTargetUrl()

@TomaszJanusz
Copy link

@phalcon
Yes setTargetUri is not intended to pass URL, but setPrefix is (http://docs.phalconphp.com/en/latest/reference/assets.html#prefixes).
setPrefix not working right with JsMin filter.

@stale
Copy link

stale bot commented Apr 17, 2018

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

@stale stale bot added the stale Stale issue - automatically closed label Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale issue - automatically closed
Projects
None yet
Development

No branches or pull requests

5 participants