Method: Proscenium::Importer.sideload
- Defined in:
- lib/proscenium/importer.rb
.sideload(filepath, **options) ⇒ Object
Sideloads JS and CSS assets for the given Ruby filepath.
Any files with the same base name and matching a supported extension will be sideloaded. Only one JS and one CSS file will be sideloaded, with the first match used in the following order:
- JS extensions: .tsx, .ts, .jsx, and .js.
- CSS extensions: .css.module, and .css.
Example:
- `app/views/layouts/application.rb`
- `app/views/layouts/application.css`
- `app/views/layouts/application.js`
- `app/views/layouts/application.tsx`
A request to sideload ‘app/views/layouts/application.rb` will result in `application.css` and `application.tsx` being sideloaded. `application.js` will not be sideloaded because the `.tsx` extension is matched first.
77 78 79 80 81 82 |
# File 'lib/proscenium/importer.rb', line 77 def sideload(filepath, **) return if !Proscenium.config.side_load || ([:js] == false && [:css] == false) sideload_js(filepath, **) unless [:js] == false sideload_css(filepath, **) unless [:css] == false end |