Questions tagged [assetic]

Assetic is an asset management framework for PHP.

assetic
Filter by
Sorted by
Tagged with
104 votes
6 answers
111k views

Path of assets in CSS files in Symfony 2

Problem I have a CSS file with some paths in it (for images, fonts, etc.. url(..)). My path structure is like this: ... +-src/ | +-MyCompany/ | +-MyBundle/ | +-Resources/ | +-assets/ | ...
apfelbox's user avatar
  • 2,634
104 votes
1 answer
3k views

Symfony get Asset Name in Assetic output

I generate my file with code like this: {% block head_stylesheets %} {% stylesheets filter='?uglifycss' '@MyBundle/Resources/public/less/myfile.less' %} <link href="...
BENARD Patrick's user avatar
81 votes
1 answer
28k views

Difference between assetic:dump and assets:install

In Symfony2, what is the difference between assetic:dump and assets:install? In what scenarios should each of these commands be used, and in what order (if order is relevant)?
Richard Keller's user avatar
56 votes
17 answers
114k views

How to get the full url for an asset in Controller?

I need to generate some JSON content in controller and I need to get the full URL to an uploaded image situated here : /web/uploads/myimage.jpg. How can I get the full url of it? http://www....
i.am.michiel's user avatar
  • 10.4k
34 votes
3 answers
63k views

Symfony 2 - Working with assets

I need some tips on how to work with assets in Symfony 2. For example, do we have to always perform the assets:update every time an image is added ? I know Assetic take care of the management on css ...
Frank6's user avatar
  • 1,203
26 votes
2 answers
16k views

Combining Assetic Resources across inherited templates

We are building a new site using Symfony2, and Assetic looks very promising for resource management, in particular for combining and processing all js/css files together automatically. We wil have ...
Ken Cooper's user avatar
25 votes
4 answers
80k views

Symfony2 Path to image in twig template

I store img in Acme/DemoBundle/Resources/public/img/weather_icon/blizzard.gif I want to put this img in my template so I did <img src="{{ asset('bundles/acmedemo/img/weather_icons/blizzard.gif') }}...
konadrian's user avatar
  • 587
25 votes
5 answers
17k views

Assetic generating links but no files

I'm trying to use assetic in symfony2 to manage my css. The links are generated fine. However, no files are generated. Here's my configuration: Layout.html.twig {% stylesheets '@...
Thomas K's user avatar
  • 6,176
22 votes
9 answers
16k views

Assetic - Route "_assetic_001d5b7_0" does not exist

This question seems to have been asked multiple times but none of the solutions work for me. I'm in my prod environment, here is what I've done: cleared cache before/after doing anything attempted ...
greg's user avatar
  • 6,873
21 votes
1 answer
5k views

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

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. ...
wowpatrick's user avatar
  • 5,140
18 votes
2 answers
12k views

How to have Assetic + sass work with Symfony2 in Windows?

I'm trying to get Assetic to run within Symfony 2.0.11 in order to use sass for css files. I've been fiddling around that issue for hours, and from what I gather the current assetic version (1.0.2) ...
17 votes
1 answer
64k views

Adding JS and CSS cleanly from included Twig templates

I'm looking to find out if there's a clean way to add JS and CSS from included templates. So, for example, if layout.html.twig has: {% include 'GenericBundle:Generic:page.html.twig' with {'data': ...
Andrew Stirling's user avatar
15 votes
3 answers
8k views

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

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/...
Tower's user avatar
  • 101k
15 votes
3 answers
10k views

Symfony2 Assetic wrong cssrewrite resources path in css/less files

The cssrewrite filter produces wrong urls after the rewrite: i have my bundle which contains one .less file located in Resources/public/less/common.less I also have one image,located in Resources/...
Stormsson's user avatar
  • 1,469
14 votes
1 answer
18k views

Symfony2 Assetic get asset urls from inside controller, not template

I want to include the url to one of the assets in my bundle in the controller, not in the template. More specifically, but not very important: I make a HighChart chart using obHighChartsBundle, and ...
Piddien's user avatar
  • 1,446
14 votes
5 answers
17k views

Configure output dir for Assetic in Symfony2

I'd like to globally configure the output dir of where assetic dumps my JS files. Currently, they always go to web/js/*. I want to change this to web/js/compiled/*. It's possible to specify this at ...
anushr's user avatar
  • 3,352
14 votes
1 answer
1k views

Symfony Assetic - part_1 in url

Okay so I've been searching all over for some input into this but haven't found anything to help directly (only mentions of this problem in relation to something else). Basically I'm having problems ...
methodin's user avatar
  • 6,712
13 votes
5 answers
18k views

Pass a variable to an Assetic asset URL in Symfony2

Is there a way to pass a variable to the Assetic method in templates {% stylesheets '@SomeExampleBundle/Resources/views/ SOMEVAR /css/*' %} <link rel="stylesheet" href="{{ asset_url }}" /> {...
ed209's user avatar
  • 11.2k
13 votes
3 answers
20k views

Assetic unable to find file

I am trying to link a css file (that lives in a bundle) inside a twig template : {% stylesheets '@AcmeFooBundle/Resources/public/css/bootstrap.min.css' %} <link href="{{ asset_url }}" ...
Nikos's user avatar
  • 714
13 votes
6 answers
27k views

Static assets not refreshing with symfony2 clear cache command

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 ...
musoNic80's user avatar
  • 3,698
13 votes
3 answers
5k views

Vagrant, shared folder: take advantage of inotify over NFS

Our Symfony2 webapp uses the Assetic watcher in development mode to re-compile assets on the go. The webapp runs in a Docker container which runs in a Vagrant VM (Ubuntu 12.04 Precise). The host is ...
arnaud.breton's user avatar
12 votes
4 answers
9k views

How can I force assetic to render assets each time the page is reloaded?

How can I force assetic to render assets each time the page is reloaded (no matter if assets are modified or not)? More explanation about my issue: I'm currently working on a Symfony2 project where ...
Evarouss's user avatar
  • 121
12 votes
1 answer
6k views

Dynamic CSS/Javascript in Twig using Silex/SilexExtensions and Assetic

What I want to do: Get CSS properties from a database and dump it into a less file. Then apply a less/yui compress-filter on it and dump the output in my twig template. Let me just come to the point ...
mayrs's user avatar
  • 2,337
11 votes
4 answers
16k views

How to add specific files to assetic?

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....
Olivier Pons's user avatar
  • 15.6k
11 votes
1 answer
13k views

Symfony2 Assetic Route and Resource Errors

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): ?&...
user257980's user avatar
  • 1,069
11 votes
2 answers
8k views

Symfony 2.3 - Using Twitter Bootstrap 3 with LESS, installed as a vendor through composer setup, unable to access Glyphicons fonts

I want to use the Twitter Bootstrap with Symfony 2 without using bundles. I've managed to install MopaBootstrapBundle, but decided to remove it and use plain TB. Setup composer.json "require": { ...
VMC's user avatar
  • 1,388
11 votes
2 answers
20k views

Run CSS file through Twig when using {% stylesheets %} tag in Twig with Symfony2

I'm including CSS stylesheets in my template like so: {% stylesheets "@SomeBundle/Resources/assets/css/default.css.twig" "@SomeBundle/Resources/assets/css/global.css.twig" %} <link rel=...
Not Available's user avatar
10 votes
3 answers
6k views

Load order in Symfony2 assetic for JS files

I am currently using a bootstrap template that uses a few JS files. To get them to load I placed all the required JS files in the app/Resources/views/base.html.twig file. Here is a snippet of the ...
John Crawford's user avatar
10 votes
4 answers
9k views

Symfony2, where to put css, javascript, images

I'm a beginner at Symfony2, and I have some problems about putting resource like css, js, images... I just read this document how to use Assetic But I can't figure out what is the best way to put my ...
Vien Le Mai's user avatar
10 votes
3 answers
2k views

symfony2: using assetic-dump, is possible to dump just one file?

After running php app/console assetic:dump --env=prod all the assets are dumpped. Is there any way to dump only one file?
tirenweb's user avatar
  • 31.3k
10 votes
1 answer
2k views

source mapping with assetic in symfony2

there is this cool feature Source Maps in html5. In my Symfony2 project I use jQuery mobile which uses this feature (I use the BmatznerJQueryMobileBundle for integration). In my <head> i do ...
Tuxes3's user avatar
  • 437
10 votes
1 answer
2k views

Symfony 2 Assetic css and js 404 within production environment

I have installed Symphony2 framework and created my own bundle. I am using assetic for my js and css files. I am running ubuntu on my server and mint on my local machine. When I access the app_dev....
Adamski's user avatar
  • 879
10 votes
1 answer
3k views

assetic - unable to write assets

Here's my directory structure (this is just a test project): stan@mypc:/generate_assets$ sudo tree -L 3 -p . ├── [drwxr-xr-x] assets │   └── [drwxr-xr-x] css │   ├── [-rw-r--r--] test1.css │   ...
Randy Marsh's user avatar
10 votes
2 answers
15k views

Symfony2 Assetic + Twig Template JavaScript Inheritance

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 ...
JamesHalsall's user avatar
  • 13.4k
9 votes
3 answers
3k views

Symfony2 the template does not support the "bundle" parameter

I'm working on a project with friends, using git. Yesterday, a friend pushed some stuff relative to his bundle, but after I pull it, I got this strange error message An exception has been thrown ...
ovesco's user avatar
  • 633
9 votes
4 answers
8k views

Making Symfony 2 Assetic development comfortable

I'm looking for ways to make Symfony 2 Assetic 1.0.2 development easier. I use Assetic for dumping/publishing my assets. Currently I keep running this command in the background: php app/console ...
Tower's user avatar
  • 101k
9 votes
3 answers
3k views

Is it possible to compile Symfony2 assetic:dump and deploy that rather than run it on the server?

I have a problem on my production server where assetic:dump is timing out on a Capifony deploy (but not always). Running assetic:dump locally is fine. Also deploying to a different staging (much less ...
ed209's user avatar
  • 11.2k
9 votes
1 answer
1k views

Using Gaufrette Stream Wrappers with AsseticBundle

I'm trying to use a Gaufrette Stream Wrapper to tell the AsseticBundle where to dump the project assets but I can't make it recognize them. This is how the knp_gaufrette section of my config_dev.yml ...
Marcel Hernandez's user avatar
8 votes
6 answers
15k views

Symfony2 Assetic: Path to node executable could not be resolved

When running app/console assetic:dump, I am getting: Path to node executable could not be resolved What does it mean and how to fix this? When trying to browse project via app_dev.php, I am ...
Serhii Smirnov's user avatar
8 votes
4 answers
7k views

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

I include my CSS with the following code: {% stylesheets 'bundles/majorproductionssewingdivasite/css/*.css' filter='cssrewrite' %} <link rel="stylesheet" type="text/css" href="{{ asset_url }}" ...
Major Productions's user avatar
8 votes
2 answers
3k views

Method Assetic\AssetWriter::getCombinations() does not exist exception on symfony2 deploy using capifony

My deployment fail when calling: cd /var/www/prod/releases/20130513164742 && php app/console assetic:dump --env=prod --no-debug My setup worked fine yestertay but today I can't deploy it ...
0x1gene's user avatar
  • 3,389
8 votes
2 answers
691 views

How do I specify a tsconfig.json for assetic's TypeScript filter?

I'm using Symfony 3.3 and the assetic bundle. I have this in my config.yml: assetic: debug: '%kernel.debug%' use_controller: '%kernel.debug%' filters: cssrewrite: ~ ...
zakdances's user avatar
  • 22.8k
8 votes
3 answers
4k views

Symfony assetic:dump runtime exception

I'm stepping into deploying my Symfony app using Capifony. When Capifony executes assetic:dump I get a runtime Exception. [RuntimeException] Unable to write file {path}/releases/20130314071536/...
Michi's user avatar
  • 2,500
7 votes
3 answers
3k views

How to optimally serve and load JavaScript files?

I'm hoping someone with more experience with global-scale web applications could clarify some questions, assumptions and possible misunderstandings I have. Let's take a hypothetical site (heavy ...
Adam Lynch's user avatar
  • 3,370
7 votes
1 answer
9k views

Symfony2 cssrewrite filter's image paths are way off

I'm trying to get Symfony2 to work with jQuery UI. I've gotten the JavaScript portion of it working just fine but I'm having trouble getting the images to work. One thing I read in the Assetic docs ...
Jason Swett's user avatar
  • 44.4k
7 votes
2 answers
541 views

Custom Symfony2 filter not triggering with custom twig tag

TL:DR; Adding type="application/dart" makes Assetic ignore the filter flag filter=MyCustomFilter. Removing the latter attribute type triggers filter=MyCustomFilter just fine. But I need the ...
Tek's user avatar
  • 2,980
7 votes
2 answers
16k views

Using Twig for dynamic Javascript files

I'm working on a kind of dashboard mini site that has blocks with a certain functionality. Using symfony2 I have a dedicated route /instagram that gets an html fragment that shows all the images taken ...
Roderik's user avatar
  • 401
7 votes
2 answers
1k views

Runtime exception when trying to dump assetic for Symfony2 project using Windows 7

I am using Windows platform (please do not laugh at me). And I am trying to build a Symfony2 project using asseti in my localmachine that is running Windows 7. Now I can not for the love of my life ...
Hello Universe's user avatar
6 votes
2 answers
15k views

Symfony2 - Assetic - css font icons

How to include css font icon libraries istalled via composer in /vendor dir (fontawesome for example). Include: {% stylesheets filter='cssrewrite' '%kernel.root_dir%/../vendor/fortawesome/font-...
Alex.Sh's user avatar
  • 123
6 votes
1 answer
2k views

Symfony 2 - Assetic JavaScript compression causing errors

I'm trying to put a Symfony 2 app in production mode. It all runs fine except for the fact that the compressed single JavaScript file causes errors and makes the site unable to render correctly. I ...
BrunoLogan's user avatar

1
2 3 4 5
14