8000 [FrameworkBundle] Enable assets by default by jakzal · Pull Request #13672 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Enable assets by default #13672

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

Merged
merged 1 commit into from
Feb 16, 2015
Merged

Conversation

jakzal
Copy link
Contributor
@jakzal jakzal commented Feb 12, 2015
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #13667
License MIT
Doc PR -

This should make the tests pass again.

There are two templates from TwigBundle that are used with functional tests, and require the asset() helper:

  • src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig
  • src/Symfony/Bundle/TwigBundle/Resources/views/layout.html.twig

@fabpot
Copy link
Member
fabpot commented Feb 12, 2015

Given that this is BC break (the change I made earlier today), I think the better fix is to add symfony/asset as a dep for FrameworkBundle (as it was included via symfony/templating before).

@jakzal
Copy link
Contributor Author
jakzal commented Feb 12, 2015

Does it also mean that assets should be loaded automatically, without the need to enable them in the config?

@stof
Copy link
Member
stof commented Feb 12, 2015

@jakzal it means that they should be enabled by default in the FrameworkBundle config (we could keep the possibility to disable them explicitly if you don't want the asset system, but I'm not sure it is worth it given it does not add overhead but only defines a few services IIRC)

@fabpot
Copy link
Member
fabpot commented Feb 12, 2015

Well, I fear that the answer is yes, to keep BC. We might revisit this decision in 3.0 though.

@jakzal
Copy link
Contributor Author
jakzal commented Feb 12, 2015

Cool. I'll update this PR.

@xabbuh xabbuh mentioned this pull request Feb 12, 2015
@Tobion
Copy link
Contributor
Tobion commented Feb 12, 2015

What about disabling all components by default in symfony 3.0.
I think it's really confusing that some things are enabled by default and others are disabled by default. This way it's really hard to configure a symfony where only the stuff you need is enabled because you have to figure out all the defaults first.

@jakzal
Copy link
Contributor Author
jakzal commented Feb 12, 2015

This is ready.

@jakzal
Copy link
Contributor Author
jakzal commented Feb 12, 2015

@Tobion 👍 I'm in favor of disabling everything by default.

@@ -53,6 +53,14 @@ public function getConfigTreeBuilder()
return $v;
})
->end()
->beforeNormalization()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should rather be done on validate. Otherwise, you will create issues if 1 file uses the old syntax, because you will inject the new syntax in all other config files being merged

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot. Unfortunately, in validate I'll need to explicitly provide assets config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed. But it is better than a broken implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously ;)

I just pushed the change.

@@ -84,6 +84,14 @@ public function getConfigTreeBuilder()
'base_urls' => array_values(array_unique(array_merge($config['base_urls']['http'], $config['base_urls']['ssl']))),
);
}
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the wrong place to set it (you are enabling it only when templating is set, while it should always be set)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. That's why I initially added it in a separate section in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, but isn't templating always set at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answering my own question: not necessarily.

We need to enable assets if they're not enabled, but only if templating doesn't contain asset configuration.

PR Updated.

@jakzal jakzal changed the title [FrameworkBundle] Enable assets in tests. [FrameworkBundle] Enable assets by default Feb 13, 2015
@fabpot
Copy link
Member
fabpot commented Feb 16, 2015

Indeed, having everything disabled by default would be better; and Symfony SE can enable the most important things and add comments to enable less important features. Anyone willing to work on this for 3.0?

@fabpot
Copy link
Member
fabpot commented Feb 16, 2015

Thank you @jakzal.

@fabpot fabpot merged commit f5c0a69 into symfony:2.7 Feb 16, 2015
fabpot added a commit that referenced this pull request Feb 16, 2015
This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] Enable assets by default

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13667
| License       | MIT
| Doc PR        | -

This should make the tests pass again.

There are two templates from TwigBundle that are used with functional tests, and require the asset() helper:
* src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig
* src/Symfony/Bundle/TwigBundle/Resources/views/layout.html.twig

Commits
-------

f5c0a69 [FrameworkBundle] Enable assets by default.
@Tobion
Copy link
Contributor
Tobion commented Feb 16, 2015

Created issue #13703 to track this

@jakzal jakzal deleted the enable-assets branch February 16, 2015 10:38
weaverryan added a commit to weaverryan/symfony that referenced this pull request Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0