-
Notifications
You must be signed in to change notification settings - Fork 76
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
assetic:dump does not scan all themes #25
Comments
are you using the latest version of the bundle ? there should be an assetic integration now |
yes i did pull git the assetic bundle and liipTheme bundle |
did you configure the bundle in question in the assetic configuration? |
i did... |
can you search for the |
ping? |
ok. sorry.... |
hmm i cannot reproduce the issue locally. the relevant class is as you can see i am using the parameter to determine the list of themes to iterate over. |
i can confirm this problem in the generated cache file all paths are loaded as Resource. You can test this when you create a layout file with a asset and a theme with the same file with another asset. Now it generate only routes or assets (assetic:dump) for the default theme (Resource/view), but not for all themes. After some debugging i think the problem is that the TemplateLocator does not know where the resource template file is it gets lost in the FileResource. /path/to/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/FileResource.php has two properties path and bundle string(116) "/path/to/vendor/bundles/Gf/MyBundle/Resources/themes/phone/layout_mo.html.twig"
string(16) "GfMyBundle" getTamplate() gives createTemplateReference() string(16) "GfMyBundle"
string(19) "layout_mo.html.twig" so createTemplateReference() create the following TemplateReference object(Symfony\Bundle\FrameworkBundle\Templating\TemplateReference)#389 (1) {
["parameters":protected]=>
array(5) {
["bundle"]=>
string(16) "GfMyBundle"
["controller"]=>
string(0) ""
["name"]=>
string(9) "layout_mo"
["format"]=>
string(4) "html"
["engine"]=>
string(4) "twig"
}
} |
so this is a limitation in assetic bundle? |
Hi, I can confirm this problem with the newest version of the master branch too. What is the status? Is somebody working on it atm? |
not that i am aware of anyone working on this :( |
ping |
Hello, I have the same kind of problem. Our themes come from database, so when TemplateResourcesPass is called, liip_theme.themes is empty. So no loop, and therefore no DirectoryResourceDefinition created. Is there any reason to add specific path for each theme ? By removing the loop, and add directly the code below, everything work. $resources[] = new DirectoryResourceDefinition(
$bundleName,
$engine,
array(
$container->getParameter('kernel.root_dir').'/Resources/'.$bundleName.'/themes/',
$bundleDirName.'/Resources/themes/',
)
); From my mind, it would resolve all this kind of problem, no ? |
I think I get this as well, maybe there should be a work around? Also, @tyx your suggestion will create a problem because not all themes are active I think. |
i have the same problem now! in sulu we use all themes together and decide with the url which theme is active! but for assetic only one theme is active and crawled! This causes lots of problems ... are there a fix for this issue? /cc @chirimoya |
Same problem here - Issue #110. The theme could be added after TemplateResourcesPass is called, liip_theme.themes is empty and will be set later over eventlisteners or any other way. We need an easy solution - what could we do? |
after having this problem i found a workaround. i had to move my themes to the "views"-folder and changed the configuration to use these folders. now assetic is loading all theme-styles. # src/Acme/LayoutBundle/Resources/views/themes/default/layout.html.twig
# src/Acme/LayoutBundle/Resources/views/themes/mobile/layout.html.twig
# src/Acme/LayoutBundle/Resources/views/themes/tablet/layout.html.twig
#
liip_theme:
themes: ['default', 'tablet', 'mobile']
active_theme: 'default'
load_controllers: false
path_patterns:
app_resource:
- %%app_path%%/views/themes/%%current_theme%%/%%template%%
- %%app_path%%/views/%%template%%
bundle_resource:
- %%bundle_path%%/Resources/views/themes/%%current_theme%%/%%template%%
bundle_resource_dir:
- %%dir%%/views/themes/%%current_theme%%/%%bundle_name%%/%%template%%
- %%dir%%/views/%%bundle_name%%/%%override_path%% before these changes only the last theme "mobile" was rendered - the others were ignored. |
Created a PR which seems to fix this: #118 |
#118 is merged. can we close this issue now? |
I did test the the config: liip_theme:
themes: ["default", "testtheme", "testtheme2"]
active_theme: "default"
load_controllers: false
assetic:
use_controller: false |
@alexander-schranz you need to explicitly enable assetic integration, check the README file. |
sorry forget the assetic_integration: true it works awesome @dantleech |
Great! Good work dan! |
so i have configured my config :
liip_theme:
themes: ['AAA', 'BBB']
active_theme : 'BBB'
and i executed :
./app/console cache:clear --env=local
./app/console assetic:dump --env=local
but the dump just scan for BBB theme dir only
And AAA not scanned
i want the theme is dynamic, so the assetic:dump must scan all themes dir
The text was updated successfully, but these errors were encountered: