-
Notifications
You must be signed in to change notification settings - Fork 18
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
Unable to use absolute path to compiled source #25
Comments
@pgilad could you help? |
I don't think there is a middle way here (without adding an option). If you want to go with absolute paths, that's fine, but you will need to specify the full path to output to. for example, in your case, that might be: But if you go with relative paths, they will be relative to your project root. It's impossible to guess which option you want without adding an option for that (which I'm very reluctant to do, this plugin is already loaded with options). But if you must go with absolute path, just specify the entire path (from root of your system / ) to the compiled file. |
So if I write |
Why are you required to use absolute paths? Is that because of the way your routing is setup? |
My static processed by nginx by the following route:
So I need my all javascript included in html looks like the following:
|
Ack I'm no nginx expert, but you can try url rewrite? so if someone hits with a public path you re-write it to your relative path (perhaps drop the non-needed part with regex). |
@pgilad Many sites require to use domain name in their scripts like:
What in this case? |
I think that's usually bad design, since you always load the scripts from your domain root. The ones you don't are from cdn (or external), but either way - you don't compile them. Another solution is to use something like |
@pgilad your solusion about droping the leading / and go for relative routing is good but if I have the page with address
My |
There are 2 things to note here:
I suggest tweaking server routing to point at the location of the scripts, even if you use custom routing. Doing thing like re-writing urls in the build step, and using absolute urls is hard. It's possible but it's a lot of work. If you feel that rewriting target urls is important, feel free to add a PR (with tests off course). But notice - it will have problems with things that rename file, such as the |
@pgilad Thanks for the answer I think I'll resolve my problem by using re-writing urls. Thanks for the help and for the good grunt plugin |
👍 |
In your examples you use relative path to compiled source like the following:
But I need to use absolute path to scripts.min.js like the following:
But if do as above then my scripts.min.js will be saved on my file system in root
public
directory instead my deployment path.How could I set absolute path
/public/js/scripts.min.js
to my compiled script and reside it in my deployment folder instead root one?The text was updated successfully, but these errors were encountered: