Sha256: 961072ccde0a5be7095e1f51686c1a39f5b62f3938cb154ea522831ba4522c51

Contents?: true

Size: 1 KB

Versions: 11

Compression:

Stored size: 1 KB

Contents

## Rails assets

### Problem
When client js uses images in render methods, e.g. `<img src='...' />` or in css, e.g. `background-image: url(...)` 
these assets fail to load. This happens because rails adds digest hashes to filenames 
when compiling assets, e.g. `img1.jpg` becomes `img1-dbu097452jf2v2.jpg`. 

When compiling its native css Rails transforms all urls and links to digested 
versions, i.e. `background-image: image-url(img1.jpg)` becomes 
`background-image: url(img1-dbu097452jf2v2.jpg)`. However this doesn't happen for js and 
css files compiled by webpack on the client side, because they don't use 
`image-url` and `asset-url` and therefore assets fail to load.

### Solution

Create symlinks of non-digested versions to digested versions when Rails assets compile.
The solution is implemented using `assets:precompile` after-hook. The assets for symlinking
are defined by `config.symlink_non_digested_assets_regex` in `config/initializers/react_on_rails.rb`.
To disable symlinks set this parameter to `nil`.

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
react_on_rails-6.0.0.rc.6 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.rc.5 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.rc.4 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.rc3 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.rc.2 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.rc.1 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.beta.5 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.beta.4 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.beta.3 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.beta.2 docs/additional-reading/rails-assets.md
react_on_rails-6.0.0.beta.1 docs/additional-reading/rails-assets.md