Skip to content

Conversation

@kriswallsmith
Copy link
Contributor

I've refactored asset packages. These are the two main benefits:

  • Base asset URLs are chosen smartly based on whether the current request is secure.
  • You can configure a version format string. This value defaults to %s?%s but could also be set to (for example) release-%2$s/%1$s if you want to move the version into the path

The following methods have been removed from the assets helper, but I can patch them back in if this is an issue:

  • getBasePath()
  • setBasePath()
  • getBaseUrl($path)

Added support for a configurable format string used to apply version to a path (defaults to '%s?%s').

Moved base url/base path logic to packages.
@kriswallsmith
Copy link
Contributor Author

I'd like to see this merged before the next release. Can we review sometime soon?

@fabpot fabpot merged commit d9f5c99 into symfony:master Jun 4, 2011
@shieldo
Copy link
Contributor

shieldo commented Mar 19, 2012

I'd also raise the question of why request scope was added here? I have a similar issue to @jmikola. It may be that asset URLs can be dependent on whether a current request is secure, but if a request is not present (i.e. this is a CLI script) can we not either assume an HTTP default for the protocol, or provide an easy way to determine which protocol should be used in URL generation?

(Would be happy to look into code/ submit a PR if there is a consensus that there is an ongoing problem here, and no workround I'm not aware of.)

@jmikola
Copy link
Contributor

jmikola commented Mar 19, 2012

@shieldo: I developed a work-around some time ago: #2223

If you configure your asset packages to use SSL for all of their base URL's, request scoping will not be introduced. The individual, named asset packages will not have a request scope (see: FrameworkBundle::createPackageDefinition()), nor will the package manager (see registerTemplatingConfiguration()). In any other situation, the request dependency exists because we need to know what the current protocol is to select a base URL.

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

Successfully merging this pull request may close these issues.

6 participants