Precompile locomotive-cms assets only once - ruby-on-rails

I have a rails application with locomotive cms engine mounted.
Compilation of all locomotive assets takes a lot of time (5-10 minutes). Since I do not change locomotive assets, I would like to precompile it only once.
The best solution would be to force rake assets:precompile to compile only application assets and skip compilation of locomotive assets. Already compiled locomotive assets might be added to the git repository.
Is there any easy way to achieve this?

Try Turbo Sprockets. From the README:
Speeds up your Rails 3 rake assets:precompile by only recompiling
changed assets, based on a hash of their source files
Only compiles once to generate both fingerprinted and non-fingerprinted assets

Related

Rails 3.2 Asset Precompile is skipping files

Stack
Ruby 1.9.3
Rails 3.2.12
Issue
We have precompilation issues with our application.
We're trying to remove config.server_static_files = true and config.assets.compile = true from our production configs, but are constantly missing assets whenever we precompiled. Even though these assets live in app/assets, while other files in the same directory are seen and compiled.
Ex:
app/assets/stylesheets/application.css
app/assets/stylesheets/some_slider_lib.css
app/assets/stylesheets/bootstrap.min.css
After precompiling
public/assets/application-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.css
public/assets/some_slider_lib-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.css
And the manifest.yml is also missing the bootstrap file among other assets.
Same thing with our vendor folder.
Attempts
The following is the only way that I've managed to precompiles everything.
config.assets.precompile += ["*.css", "*.scss", "*.js", "*.coffee"]
However, this feels like overkill. I thought all files within the asset pipeline would be compiled. Is this not what is suppose to happen?
Also tried rake assets:precompile --trace, but this was unhelpful.
If anyone could provide a little guidance, suggestions or more it would be deeply appreciated.
Thanks!

When does Rails compile application.css?

I have a Rails app where I replaced a xxx.cs.scss file in assets/stylesheets/.
I restart Rails on my Mac using $ rails s.
And the old xxx.cs.scss is still in the application.css file according to my browser.
Why wouldn't the application.css file get re-compiled?
Thanks for the help!
Double check the asset compilation options in your environments/development.rb file to see if compilation is turned off.
Also, if you previously pre-compiled your assets (via rake assets:precompile) the compiled assets will take precedence over the on-demand compiled assets in your development environment. You may want to do rake assets:clean to get rid of any pre-compiled assets, then restart your local Rails server, and try again.

Heroku asset compile not working with Rails 3.2 application

I feel like I have exhausted my resources trying to figure this out. I have yet to run into this error with a heroku/rails app before and am simply puzzled as to why my js/css isnt being compiled/uploaded to Heroku.
As stated in the heroku docs your options are to:
1. Compiling assets locally.
2. Compiling assets during slug compilation.
I tried the first option: ran RAILS_ENV=production bundle exec rake assets:precompile, added public/assets and saw the "Detected manifest.yml, assuming assets were compiled locally" line when deploying. No CSS.
I tried the second option (clean git checkout before assets:precompile). Added the 'config.assets.initialize_on_precompile = false' line as suggested for rails 3.x apps. And instead of seeing the expected:
Compiled jquery.js
Compiled jquery_ujs.js
Compiled application.js
Compiled application.css
etc etc
I get 'DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins!' warnings. yet that folder is completely empty
Looked into this warning with no sign of it being the root cause for this. Feels like I'm going in circles so I am hoping someone has insight. Thanks in advance!
Heroku docs suggests that add 'rails_12factor' gem to gemfile. Precompling assets before pushing to heroku is not required. And you also must use Heroku's cedar stack only.

Why do I have to precompile my assets in development?

Lately I have to precompile my assets to see my css changes in my development environment. I don't know why this, the environment setting config.assets.debug is still set to true. I find this rather annoying, I believe I didn't have to run precompile after every change before. How do I make rails compile on page load again?
I'm running Rails 3.1.3. I don't know what other info to provide, please let me know what you need to know to solve this.
Try completely removing your compiled assets and it should reset to the default development behavior. Otherwise, Rails will keep trying to load your precompiled public/assets/ files before loading the stuff under app/assets/:
rake assets:clean

Rails precompile - all.js missing

I am new to rails and using version 3.1.0 and trying to deploy to heroku. I have a very simple application that i have managed to get up and running on heroku after working my way through several issues. I used the command
bundle exec rake assets:precompile
to get heroku to load the assets for the application (i read that heroku requires this for version 3.1.0). The problem is that when i try to run the application, the server gives the error
ActionController::RoutingError (No route matches [GET] "/assets/all.js"):
i have all of the required javascript files in public/javscripts but i cannot find any version of all.js in the assets directory. I have included
config.assets.precompile << '*.js'
in config/application.rb but to no avail.
I was wondering if someone could tell me how I get the precompile to create all.js in the assets directory or if I am completely off track here. i was under the impression that the precompile function compiled all of the javascript files into a single optimized file.
Also, if anyone has any good links for a beginner to understand how the precompile functionality works in rails I would be very appreciative.
Thanks in advance.
The best guide is the official rails guide. There is also the Railscast about it.
In a nutshell your Javascript files go in app/assets/javascript from where the precompile task will process them and put then in the public/assets directory. You should not have to change the precompile config option if the follow the defaults. Don't forget to the use the correct helpers to reference your files.
Read the resources above, and if you are converting an existing app watch the Railscast and follow the last section of the guide - these should point you in the right direction.

Resources