Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requires are always put above any code that precedes them. #368

Closed
meh opened this issue Sep 18, 2013 · 2 comments
Closed

Requires are always put above any code that precedes them. #368

meh opened this issue Sep 18, 2013 · 2 comments

Comments

@meh
Copy link
Member

meh commented Sep 18, 2013

This is a sprockets constraint, we have to find a solution because it becomes impossible to run code in gems, it's also extremely unintuitive.

@adambeynon
Copy link
Contributor

This is a inherited problem from using sprockets. If we want to be able to require files in an exact place in ruby code, then we would probably have to add some client side storage of compiled files to be able to load them, e.g.:

opal.register('opal/array', function() {  });
opal.register('parslet', function() {  });
opal.register('parslet/foo', function() {  });

And then require would work off some opal function:

opal.require = function(path) {  };

Or, we could add some parser subclass for shooting off to require.js, or something similar, which could handle that for us.

(For what its worth, I will personally continue using opal-sprockets, but it is now removed from core, so opal-require-ms or similar would be just as useful).

@adambeynon
Copy link
Contributor

Moving this to opal-sprockets as it belongs there (opal just compiles code, opal-sprockets is responsible for handling concatenation of code).

hmdne pushed a commit to hmdne/opal that referenced this issue Jan 27, 2024
)

- replace .* and .+ with [^\n]* and [^\n]+ respectively
- allows the wildcard to match all chars in the same line, including separators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants