{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/elixir/issues/341","labels_url":"https://api.github.com/repos/laravel/elixir/issues/341/labels{/name}","comments_url":"https://api.github.com/repos/laravel/elixir/issues/341/comments","events_url":"https://api.github.com/repos/laravel/elixir/issues/341/events","html_url":"https://github.com/laravel/elixir/issues/341","id":116808415,"number":341,"title":"Relative image/font paths in css don't work in .version()'ed css file; Configuring .version() buildFolder","user":{"login":"kevnk","id":1181420,"avatar_url":"https://avatars.githubusercontent.com/u/1181420?v=3","gravatar_id":"","url":"https://api.github.com/users/kevnk","html_url":"https://github.com/kevnk","followers_url":"https://api.github.com/users/kevnk/followers","following_url":"https://api.github.com/users/kevnk/following{/other_user}","gists_url":"https://api.github.com/users/kevnk/gists{/gist_id}","starred_url":"https://api.github.com/users/kevnk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevnk/subscriptions","organizations_url":"https://api.github.com/users/kevnk/orgs","repos_url":"https://api.github.com/users/kevnk/repos","events_url":"https://api.github.com/users/kevnk/events{/privacy}","received_events_url":"https://api.github.com/users/kevnk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-13T17:03:50Z","updated_at":"2015-11-16T17:28:08Z","closed_at":null,"body":"After versioning my css into `public/build/css/` for production, the relative paths to background images and fonts no longer work b/c they're in `public/img/` and `public/fonts/`. It all works locally b/c I'm using [this workaround](https://github.com/laravel/elixir/issues/309#issuecomment-156482968) to inject the css locally without page refresh, but having versioned css in production.\r\n\r\nI tried moving everything into `public/build/` and run it from there, but then the versioned files move into `public/build/build/` which leaves me with the same issue.\r\n\r\nI guess I could drop the css injection and just reload the entire page on local, but that's a pain.\r\n\r\nMy workaround (when using [this workaround](https://github.com/laravel/elixir/issues/309#issuecomment-156482968) to inject the css locally without page refresh was the following:\r\n\r\n1. add custom helpers.php to override laravel helpers.php\r\n\r\n**bootstrap/autoload.php**\r\n```php\r\n// Add custom helpers.php before autoloading other files, including laravel's helpers.php file\r\nrequire __DIR__.'/../app/Http/helpers.php';\r\nrequire __DIR__.'/../vendor/autoload.php';\r\n```\r\n\r\n2. Add `static $buildDir = '';` and modify the function to use it\r\n\r\n**app/Http/helpers.php**\r\n```php\r\n<?php\r\n\r\n/**\r\n * Get the path to a versioned Elixir file.\r\n *\r\n * @param  string  $file\r\n * @return string\r\n *\r\n * @throws \\InvalidArgumentException\r\n */\r\nfunction elixir($file)\r\n{\r\n\r\n    static $buildDir = ''; // Used to be 'build/';\r\n    static $manifest = null;\r\n\r\n    if (is_null($manifest)) {\r\n        $manifest = json_decode(file_get_contents(public_path($buildDir.'rev-manifest.json')), true);\r\n    }\r\n\r\n    if (isset($manifest[$file])) {\r\n        return '/'.$buildDir.$manifest[$file];\r\n    }\r\n\r\n    throw new InvalidArgumentException(\"File {$file} not defined in asset manifest.\");\r\n}\r\n```\r\n\r\nI'm not sure how/if it's possible to configure elixir with .env variables, but that would be ideal so I could set something like: `ELIXIR_CONFIG_VERSIONING_BUILDFOLDER='build/';` so the elixir helper function can use it AND the elixir js uses it. Instead of manually changing it in both places."},"comment":{"url":"https://api.github.com/repos/laravel/elixir/issues/comments/157109200","html_url":"https://github.com/laravel/elixir/issues/341#issuecomment-157109200","issue_url":"https://api.github.com/repos/laravel/elixir/issues/341","id":157109200,"user":{"login":"Flo-Schield-Bobby","id":1577155,"avatar_url":"https://avatars.githubusercontent.com/u/1577155?v=3","gravatar_id":"","url":"https://api.github.com/users/Flo-Schield-Bobby","html_url":"https://github.com/Flo-Schield-Bobby","followers_url":"https://api.github.com/users/Flo-Schield-Bobby/followers","following_url":"https://api.github.com/users/Flo-Schield-Bobby/following{/other_user}","gists_url":"https://api.github.com/users/Flo-Schield-Bobby/gists{/gist_id}","starred_url":"https://api.github.com/users/Flo-Schield-Bobby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flo-Schield-Bobby/subscriptions","organizations_url":"https://api.github.com/users/Flo-Schield-Bobby/orgs","repos_url":"https://api.github.com/users/Flo-Schield-Bobby/repos","events_url":"https://api.github.com/users/Flo-Schield-Bobby/events{/privacy}","received_events_url":"https://api.github.com/users/Flo-Schield-Bobby/received_events","type":"User","site_admin":false},"created_at":"2015-11-16T17:28:08Z","updated_at":"2015-11-16T17:28:08Z","body":"+1"}}