-
Notifications
You must be signed in to change notification settings - Fork 559
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
CssRewrite goes through app_dev.php in Symfony #53
Comments
Can you provide more details about how you're using Assetic and what you expect it to do? Also, can you debug to see if the target path in the CssRewriteFilter includes |
I am using the following twig commands:
In dev mode this becomes (and so on):
Now this first stylesheet uses @import that now are linked to:
Assetic config is:
In CssRewriteFilter the following $targetPath is passed for the stylesheet with the @import
$sourcePath is: bundles/hwsplatform/lsl/css/layout_3col_fixed.css |
Ok, same happens for image rewrites of course. Which 404s them aswell. |
I just noticed you're misusing the |
Did you see my note about the |
Hi Kris, If I use this notation Config settings for assetics are the same for dev&normal: assetic: |
This is a known limitation of the Symfony integration that will be addressed in Assetic 1.1 when we add support for asset dependencies. The easiest solution is to keep everything in one load path, i.e. all CSS files in web/. You can also keep these assets in your bundle’s Resources/public/ directory and install them to web/ using the assets:install command. Either way, avoid using the @mybundle notation to include stylesheets that reference images when defining your Assetic assets. On Monday, July 11, 2011 at 10:11 AM, DTown wrote:
|
@kriswallsmith can you provide a simple example that shows ho to handle the assest in one load path? |
@Imammino: Here is the example of the Kriswallsmith comment: My bundle is nammed LbpCoreBundle. My assets are in Lbp\CoreBundle\Resources\public Everytime I change something I do a "assets:install web" command. This is in the twig layout: And in my css looks like : It works for me. |
Yes, i ended up with the same solution after a while! |
You can using this command to avoid hard copy,
|
@ardianys beware that every time you update your bundles with |
Thanks for your info. I didn't know detailed behaviour of this command. Regards. |
@ardianys, never mind ;) |
Hi all, We have the same problem and solve it the same way as suggested here (reference the files on web/bundles, installing the assets and then compiling). But it is very uncomfortable when you are working on resources (or you have the option to work directly on the published web/bundles resources with the --watch assetic option, but then if you forget to copy your changes to Bundle/Resources you may overwrite them) so I put together a command that automatically listens for any changes on every Bundle/Resources, updates the asset in web/bundles and dumps the assetic file: https://gist.github.com/1378305 To use it install the command in any bundle you want and run console tracpoint:assets --watch Regards, Diego |
@diegosainz The |
@stof:Yes, that's a better solution, unfortunately for us we are developing on windows and symlink option is not supported :( |
AFAIK windows Vista + supports hardlinks... and afair PHP too. |
@diegosainz On windows, you need to run the script as administrator or to disable some of the checks (on 7 only as Vista does not allow disabling them) to be able to use the |
@stof I wasnt aware of that, Thank you! |
So when I use the relative path for CSS images (../images/[...]), the CSS gets rewritten, as it should. When I use the full path (/bundles/planbgofone/images/[...]), the CSS does not get rewritten but the images show. Does this have something to do with the "dev" environment versus prod? |
the CssRewrite filter does not work when using the |
@stof is there a bug report for this in AsseticBundle? I can't seem to find it |
Woah, this looks a little bit too complex. Is there any proposal for fixing this? |
what's the progress on this, is there any eta? Of course, very thankful for your support. |
I always use this without cssrewrite and the
|
This fix for cssrewrite is to not use cssrewrite. Nor should you add bundle paths to your css. Instead, use output as follows: {% stylesheets
output="bundles/zaysoarbiter/css/forms2.css"
'@ZaysoArbiterBundle/Resources/scss/forms2.scss'
%}
<link rel="stylesheet" href="{{ asset_url }}" media="all" />
{% endstylesheets %} This works in development mode because the whole 'bundles/...' is still just a virtual name. For production mode, use the asset:install and the assetic:dump to copy everything to your web directory. Relative paths in css will now work fine without any rewriting. |
the other way to fix it is to use the cssembed filter to embed the images in the CSS file directly. |
Is there any example for the ccsembed filter? |
I have a similiar problem: all request, going through |
It's frustrating that there's no fix for this, especially since using the bundle name is what's used all throughout the official Symfony documentation! Ridiculous. |
@kevinm1 totally agree. We need a fix... soon. |
So 1.1 is nearly out, but no fix for this yet? C'mon guys! |
@kriswallsmith : is this gonna be scheduled for 1.2? |
I'm AFK. Do we have a failing test case yet? On Thursday, June 13, 2013 at 10:26 PM, Johnny Robeson wrote:
|
I think that there should be a filter that creates new assets on each url() it finds inside css and so, so it gets managed by assetic and dumped/referenced together with the others |
This issue is now open for 3 years.... |
+1 ; any updates? |
Looking for a solution too. I'm trying to work with AWS - EC2 and S3 for assets without success |
+1 Please fix this soon! This is extremely hindering any sort of streamlined development! |
+1 for this fix. But everyone can use FkrCssURLRewriteBundle for fixing this issue |
We need an official solution which we could put into the official symfony2 documentation! |
Same problem here with Symfony 2.6 |
Same problem. |
+1 same problem, please fix this soon |
I think there will be never a fix for this. The See this warning in the Symfony2 Book: http://symfony.com/doc/current/cookbook/assetic/asset_management.html#including-css-stylesheets You should do: {% stylesheets 'bundles/app/css/*' filter='cssrewrite' %} You should NOT do: {% stylesheets '@AppBundle/Resources/public/css/*' filter='cssrewrite' %} |
I can't see any "best practice" sentence on the doc .. simply it makes us aware of the issue +1 for taking this issue on a solution |
Here is the |
@JHGitty yep I see, but this is a bp for application .. if I have a bundle to redistribute or reuse I need to have my assets bundled together with the code who uses them So I agree to avoid misuse of bundled-assets, but they are a tool that has its own field of application and can't be ignored or labeled as "poor practice" always IMHO However, I think assets should be treated all the same way ... so there should be no difference in the use of css, js or images .. I agree to use |
app_dev is driving me crazy with a web/fonts/... issue !
The resulting css "/app_dev.php/dist/main_main_1.css" file points to some bootstrap glyphicons fonts referenced with "/fonts/bootstrap/glyphi..." okey so I copied this fonts directory to /web. I then expected the browser to search for those files inside "/app_dev.php/fonts/bootstrap/glyph…", this is what is done but a 404 is served instead by the dev controller 😠 ! Is there a way to make app_dev resolve the /fonts path nicely (I mean in a clean way) ? |
This is a design bug. Since you do not work through a config switch, but with I had the same problem. The support was unfortunately no help. Also sont there
then the CSS file (scss.html.twig)
then generate 2 different scss: Another solution I have not found. The Simple tile cause must be resolved by the |
@ReneMuetti Thank you very much for sharing ! |
Using symfony2 and a cssrewrite to fix all @import they now go through app_dev.php/path/to/import/file.css which leads to 404 errors from the symfony kernel.
The text was updated successfully, but these errors were encountered: