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

Load script without ".js" file extension #18

Closed
rizkysyazuli opened this issue Oct 22, 2010 · 4 comments
Closed

Load script without ".js" file extension #18

rizkysyazuli opened this issue Oct 22, 2010 · 4 comments

Comments

@rizkysyazuli
Copy link

hi,

is there a way to disable RequireJS atomatically appending ".js" file extensions? coz i'm using a php minifier script to combine and compress my css and js assets, and the URL to call these compressed script doesn't always require a ".js" file extension. is there a way integrate this kind of workflow with RequireJS?

an example URL to call the combined script is like this:

http://example.com/min/g=scripts

here i'm loading an array named "scripts" (defined via config) which contains a list of js or css files. another example is to define it inline, like this:

http://example.com/min/f=scripts/jquery.js,scripts/site.js,scripts/home.js

as you see. i'm having trouble combining this with RequireJS (or even any script loader out there). i'm using Minify for compression: http://code.google.com/p/minify/

any help would be appreciated..

thx

@jrburke
Copy link
Member

jrburke commented Oct 25, 2010

You could use the priority config option to specify the link to the combined script URL, if you manually create that combined URL before you deploy.

That is the first thing that comes to mind. If you can describe how you might have your require() calls set up in the app, and how those relate to the URLs you want to fetch from your service, that might help trigger more ideas.

@temsa
Copy link

temsa commented May 10, 2011

another simple way is to use a dummy parameter at the end of your url, like :
http://example.com/min/g=scripts&dummy=
when requirejs will append the .js, it will probably do
http://example.com/min/g=scripts&dummy=.js

But as you probably don't mind about having an extra dummy parameter, it shouldn't get you in any trouble :)

@millermedeiros
Copy link
Member

plugin to keep file extension: https://gist.github.com/1057913 (created a couple days ago but forgot to publish it...)

@rizkysyazuli
Copy link
Author

thx for the tips guys.. will try it out :) closing this issue..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants