Precompiling assets on the production server is very slow. So I have decided to recompile them on the development machine and upload assets to the Amazon S3 by jammit. Everything’s done but I have some negative problems:
- I have to include
public/assetsdirectory togitcontrol. Because ifpublic/assetsdirectory is empty on the production server fails - If I precompile assets on the development machine
application.jsincludes in the HTML as compressed and that way I have duplicated js code. Changing js doesn’t make any effect because precompiledapplication.jsinterrupts this code.
That way my development process includes following steps:
- Remove precompiled assets if I’m going to change js or css
- Do some changes
- Precompile assets
- Upload assets to S3 by
jammit-s3 - Do commit and push my changes including assets to the git server
- Deploy by capistrano
My questions are:
- Is it possible to configure development environment don’t include compressed
application.jsif I have it inpublic/assetsdirectory? - Is it possible to configure production environment to work with empty
public/assetsdirectory? Assets will only be on the S3 server.
I resolved this problem by including assets dir in gitignore and exclude only one file –
public/assets/manifest.ymland production server works correctly now, i.e.config.action_controller.asset_host = "http://assets.example.com"works. It requires onlymanifest.ymlfile