Reputation: 642
So it's my understanding that in the symfony dev environment assets are generated on page load through the controller if use_controller is set to true.
This is however time consuming, and pages load much faster with it set to true. I use less and javascript and I do not want to dump my assets every change, as I'm constantly changing these files and viewing them.
I also don't want to wait the 20 seconds it takes to generate all the assets every page load.
Using assetic:dump --watch breaks my less files every time so it's pretty much useless for me, but sounds ideal. Only update what I update, great let's do that, then I can set use_controller to false and have minimal page load and have my assets updated.
Where is the balance here?
How can I have a fast dev env while being able to work on my assets?
Or
How can I get assetic:dump --watch to not break my css/less, as this sounds like the ideal solution. Does anyone else use less and assetic:dump --watch?
Any comments, answers, articles or advice is greatly appreciated and I know similar questions have been asked here, most pointing out to use assetic:dump --watch, which does not work for me.
Upvotes: 1
Views: 230
Reputation: 17032
I don't know for others, but the fastest way for me to get around this issue is to have the assets stored in the web/
directory. I know it's probably not the best way but after a couple of days searching through the net I just decided I was wasting my time.
So depending on the project, my assets go into the web/
path. If the project is huge and has many separate bundles, I might have it both ways:
MyCompany/MyBundle/Resources/public/(images|js|css|images)
pathweb/mystyle.css
web/mystyle.css
, do my work and then copy/paste the changes back to MyCompany/MyBundle/Resources/public/css/mystyle.scss
This saves me a lot of page load
time. Usually my load time was around 4-5 seconds, which dropped to between 0.4s and 0.7s by simply placing the assets into the web/
path. Again, I'm not pretending for this to be the best way to go, but it does the work for me. If anybody has a better way, please let me know - I would be interested as well.
Upvotes: 1