{"issue":{"state":"open","pull_request":{"diff_url":"https://github.com/kriswallsmith/assetic/pull/142.diff","html_url":"https://github.com/kriswallsmith/assetic/pull/142","patch_url":"https://github.com/kriswallsmith/assetic/pull/142.patch"},"user":{"avatar_url":"https://secure.gravatar.com/avatar/96a13b96ece78afe3c2dc841edc4a8f5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"96a13b96ece78afe3c2dc841edc4a8f5","url":"https://api.github.com/users/schmittjoh","login":"schmittjoh","id":197017},"milestone":null,"assignee":null,"updated_at":"2011-11-08T06:15:46Z","labels":[],"closed_at":null,"comments":6,"url":"https://api.github.com/repos/kriswallsmith/assetic/issues/142","body":"This adds support for compile-time variables to assets. For example, if you want to compile an asset for a specific locale/browser, then you could write something like this:\r\n\r\n```html+jinja\r\n{% javascripts \"foo.js\" vars=[\"locale\",\"browser\"] %}\r\n<script language=\"javascript\" type=\"text/javascript\" src=\"{{ asset_url }}\"></script>\r\n{% endjavascripts %}\r\n```\r\n\r\n```yml\r\n# define all possible values for each variable\r\nassetic:\r\n    variables:\r\n        locale: [\"en\", \"de\"]\r\n        browser: [\"ie\", \"other\"]\r\n```\r\n\r\n```php\r\n<?php\r\n\r\nuse Assetic\\ValueSupplierInterface;\r\n\r\nclass MyValueSupplier implements ValueSupplierInterface\r\n{\r\n    private $container;\r\n\r\n    public function __construct(ContainerInterface $container)\r\n    {\r\n        $this->container = $container;\r\n    }\r\n\r\n    public function getValues()\r\n    {\r\n        $request = $this->container->get('request');       \r\n        $client = /** some nice method to get the client from the request */;  \r\n\r\n        return array(\r\n            'locale' => $request->getLocale(),\r\n            'browser' => $client,\r\n        );\r\n    }\r\n}\r\n```\r\n\r\nI've only worked on Twig support (not sure how much of this is possible with PHP). I'll also open a PR on the AsseticBundle to add support for this.","html_url":"https://github.com/kriswallsmith/assetic/issues/142","title":"adds support for compile-time variables","number":142,"id":1994801,"created_at":"2011-10-19T15:05:38Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/96a13b96ece78afe3c2dc841edc4a8f5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"96a13b96ece78afe3c2dc841edc4a8f5","url":"https://api.github.com/users/schmittjoh","login":"schmittjoh","id":197017},"updated_at":"2011-11-08T06:15:46Z","url":"https://api.github.com/repos/kriswallsmith/assetic/issues/comments/2664261","body":"You could probably make use of this, but it won't make your examples possible. \r\n\r\nInput variables must be constants that we know at compile-time. This is necessary so that we can compile all your assets once and then only serve the correct version at runtime. Compiling something at runtime does not seem desirable to me, or only an option for really really really fast filters.","id":2664261,"created_at":"2011-11-08T06:15:46Z"}}