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

Directory for themes #9807

Closed
xElysioN opened this issue Oct 10, 2018 · 8 comments · Fixed by #9814
Closed

Directory for themes #9807

xElysioN opened this issue Oct 10, 2018 · 8 comments · Fixed by #9814

Comments

@xElysioN
Copy link
Contributor

Hi,
We still need to create our theme in app/themes in Sylius 1.3, but with the new symfony structure, app doesn't exist. (cf: https://docs.sylius.com/en/1.3/components_and_bundles/bundles/SyliusThemeBundle/your_first_theme.html)
As @pamil said on slack :
It'll be better to use the templates directory or create a top level directory themes.

Sylius version
1.3

Describe the proposed solution
Use the templates directory like templates/themes

Describe alternatives you've considered
Or create a top level directory themes

@Zales0123
Copy link
Member

It should be probably resolved by #9804? cc @pamil

@pamil
Copy link
Contributor

pamil commented Oct 10, 2018

@Zales0123 not really, #9804 solves templates resolving, their location is another issue to solve.

@Prometee
Copy link
Contributor

Prometee commented Oct 11, 2018

I just made a PR #9814 to change this.

The default path : %kernel.project_dir%/app/themes has to be changed in Sylius\Bundle\ThemeBundle\Configuration\Filesystem\FilesystemConfigurationSourceFactory, in all a test file, and documentation.

I use this conf now to get ride of this bug :

# config/packages/sylius_theme.yaml
sylius_theme:
    sources:
        filesystem:
            directories:
                - "%kernel.project_dir%/templates/themes"

I agree that templates/themes should be the new place for themes. We also need a better doc on how to build a theme with a real and updated theme skeleton.

@pamil
Copy link
Contributor

pamil commented Oct 11, 2018

After giving it some thought, I would vote for top-level themes/ directory. templates/themes/ does not look like the best place for themes, because they also contain translations and assets, which might be misleading when under templates/ directory.

@Prometee
Copy link
Contributor

My first thought was the same as yours but the templates dir is already used by SF users as the default place to override things.
If there is a root themes dir it means that you want to composer require themes outside the vendor dir when some customs themes will be available in a Bundle.

Is there any custom themes already available somewhere ?

@pamil
Copy link
Contributor

pamil commented Oct 11, 2018

Themes are mostly proprietary and made-on-demand because most of the stores need their own, unique theme.

Symfony 4 structure contains assets/, templates/ and translations/ root directories. Themes contain all of these resources (also using the old nomenclature, assets -> public and templates -> views).

With templates/themes/ there are the following issues:

  • translations and assets are under templates/ instead of their dedicated directories which is counter-intuitive
  • the structure for templates is also different than templates/bundles/:
    • overriding a bundle template templates/bundles/FooBundle/template.html.twig in a theme would be templates/themes/ThemeName/FooBundle/views/template.html.twig - so there's views directory out of nowhere

If your themes are installed via Composer, it's needed to specify that path in your sylius_theme configuration.

@Prometee
Copy link
Contributor

@pamil I change my PR #9814 to get this fact as default.

So app/themes/ default value will become themes/.

@Bonobomagno
Copy link

Bonobomagno commented Nov 9, 2018

will theme directory reflect new flex directory?

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 a pull request may close this issue.

5 participants