Replies: 1 comment
|
You would pass an array of filenames as the plugin :assets, js: %w[views/scriptA.js views/scriptB.js main.js]This is mentioned in the plugin's documentation in the Usage section, but maybe it could be better documented. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Using the
assetsplugin, how are we intended to use JS files together that need to be run in a particular order?For example, if I have this:
In development, I want the
viewfiles to be run on the page before the code inmain.js, either as separate<script>tags or concatenated ahead of the code inmain.jsIn production with asset precompilation, I want the
viewfiles to be concatenated ahead of the code inmain.jsbefore it's minifiedThis is easier with Sass since Sass files can
@importeach other in the correct orderIn Sprockets I would use the
//= requiredirective to assemble the final frontend JS files.Note: This is for a project that is not strictly using
import { … } from …on all pieces of JS.All reactions