assetic

Symfony 2 Assetic Fatal error: Class 'Assetic\Util\PathUtils' not found on asset dump

假装没事ソ 提交于 2019-12-05 09:40:33
问题 I'm using Symfony version 2.1.10 with Assetic and after the last composer update I get the follwoing error when I try to run php app/console assetic:dump Dumping all dev assets. Debug mode is on. Fatal error: Class 'Assetic\Util\PathUtils' not found in /vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php on line 216 I have no idea what is going wrong here. I checkt the GitHub issue page of Assetic and Symfony 2 and couldn't find any information ... config.yml: #

Symfony 2 how to import LESS files from another bundle

假装没事ソ 提交于 2019-12-05 08:02:56
LESS has the power to @import other LESS files. This question is intended to find a solution to import LESS files within LESS files from another Bundle in a Symfony project I'm working on a Symfony2 project, using LESS and Assetic to watch changes. My LESS files are able to import other LESS files but only if they are in the same bundle. If I try to import from another bundle Assetic watch stops with error "variable undefined" because the import fails. I've tried all sorts of paths in the import: In a LESS file in another bundle: @import "../../../../MainBundle/Resources/public/less/colors

How to make Symfony 2 asset compilation to product different filenames?

↘锁芯ラ 提交于 2019-12-04 23:11:24
I followed the guide on the very bottom of this article: http://symfony.com/doc/current/cookbook/assetic/asset_management.html I have this code: {% javascripts ... output='js/dist/dist.js' %} <script src="{{ asset_url }}"></script> {% endjavascripts %} Now if I run sf assetic:dump --env=prod it creates the compiled file properly. However, I would like to have it generating a random name (or timestamped) so that the client-side browser cache problem is avoided. Right now it always creates dist.js file which gets cached and when I update my code the users won't see the difference (or get errors)

Symfony2 Assetic + Twig Template JavaScript Inheritance

随声附和 提交于 2019-12-04 18:31:51
问题 My problem: I have 3 templates: main.html.twig (main layout file) layout.html.twig (a bundle specific layout override which contains some bundle specific JS tags) create.html.twig (a page specific template file which also contains some page specific JS tags) I am defining a block called 'javascript' in my base layout ( main.html.twig ), then overriding it (but calling {{ parent() }} in layout.html.twig . This works fine, and the JS tags from the main template file are still included above

Symfony2 Assetic Route and Resource Errors

徘徊边缘 提交于 2019-12-04 17:58:14
问题 I have template for example index.html.php where I use php assetic loader like this <?php foreach ($view['assetic']->javascripts( array('@AcmeFooBundle/Resources/public/js/*')) as $url): ?> <script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script> <?php endforeach; ?> If I do any changes for my template file I get Route "_assetic_2b431f4" does not exist. If I change assetic: use_controller: false I get Cannot load resource ".". Error. This comes when I do even one line

How to add specific files to assetic?

拈花ヽ惹草 提交于 2019-12-04 17:54:41
问题 I have my custom resources directory for my bundle where there are some files: /longpathtoSymfony/src/MyOwn/Bundle/MyOwnBundle/Resources/public |-- bootstrap | |-- css | | |-- bootstrap-theme.css | | |-- bootstrap-theme.min.css | | |-- bootstrap.css | | |-- bootstrap.min.css | | `-- carousel.css | |-- fonts | | |-- glyphicons-halflings-regular.eot | | |-- glyphicons-halflings-regular.svg | | |-- glyphicons-halflings-regular.ttf | | `-- glyphicons-halflings-regular.woff | `-- js | |--

Load one js file using assetic inside Symfony2

落花浮王杯 提交于 2019-12-04 17:06:52
I am new to Symfony 2. Previously I worked a lot with Codeigniter. Now that I am exploring assetic, I am not able to understand how I can add a single file to the stack of JS files which are already being loaded. I have a main page twig file which has something like this: {% javascripts '@BlogBlogBundle/Resources/public/js/vendor/*' output='js/combined.js' %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} Now this works fine if all the JS files are inside the vendor folder. But what if I have a JS file contact.js inside a folder called contact and I want

Static assets not refreshing with symfony2 clear cache command

假如想象 提交于 2019-12-04 17:03:42
问题 I'm using Assetic with the compass filter to pass and compile .scss files. This part of the setup seems to work fine. However, my understanding was that in the app_dev environment, Symfony 2 would recompile all assets (including css) for each page load and not use the caching system that it employs for prod environment. This seems not to be happening. When I make a change to a .scss file it will only take effect if I use: app/console cache:clear I thought the whole point of the dev

Symfony2 and Assetic - cssrewrite works perfectly for dev, not for prod

霸气de小男生 提交于 2019-12-04 11:13:49
问题 I include my CSS with the following code: {% stylesheets 'bundles/majorproductionssewingdivasite/css/*.css' filter='cssrewrite' %} <link rel="stylesheet" type="text/css" href="{{ asset_url }}" /> {% endstylesheets %} In dev, this allows me to use image sprites without any problems. The resulting URL to my sprite is: http://localhost/diva/web/bundles/majorproductionssewingdivasite/images/diva-sprites.jpg But, in prod, it gets mapped to: http://localhost/diva/bundles

symfony2 - the assetic assetic:dump command doesn't create stylesheets correctly

喜夏-厌秋 提交于 2019-12-04 08:08:00
For some reason I can't load the css files. Here is the structure of the bundle that I use BD WebsiteBundle public css And here is how I try to load the css files {% stylesheets 'bundles/bdwebsite/css/*' filter='cssrewrite' %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} I did assetic:dump What I'm doing wrong? You referred to bundles/bdwebsite/css/* in your stylesheets tag. This way assetic looks for all css files in web/bundles/bdwebsite/css (a folder that currently does not exist) and not in src/BD/WebsiteBundle/public/css . In order to have your files in the right