I just had an idea (in the mean time) but it does involve some terminal unix commands and config to get it going.
The idea is to use the Built in OS X Web Server.
We first need to do some configuration to the file that helps control the server.
Using Terminal.app we will use some command line code to access and edit this file.
The way I am doing it is to do the minimum change I can.
So open /Applications/Utilities/Terminal.app
1, First we wil do a simple back up of the file.
Type :
sudo cp /etc/apache2/httpd.conf
/etc/apache2/httpd.conf.BAK
Sudo is you asking permission to make a change as a superuser. your will be asked for an administrators password.
cp is the unix command to copy. cp [original ] [destinationCopy]
This all create a file named httpd.conf`.BAK which is a copy of the original.
2, Now we can open up the original file.
sudo nano /etc/apache2/httpd.conf
nano is a command line text editor.
This will open the file in an old style word processor.
You can use the arrow keys to scroll or move to you destination.
If at anytime you make a mistake you can exit with out saving by using the,
ctrl + x keys.
This will prompt you to save y/n.
Type:
n then hit the enter key
And start again.
If you are happy with what you have done the type :
y then hit the enter key
The normal location for the web server /site files are held in is ‘/Library/WebServer/Documents’
We will want to change the server directory to a sites folder in our home directory.
2, Still with the httpd.conf` file open in nano, hold down the ctrl and press w key.
This will show a search field at the bottom of the nano window.
Type :
WebServer
in the field and the hit the enter key. This will take you down to the lines you need to change.
Change the two lines:
DocumentRoot "/Library/WebServer/Documents" <Directory "/Library/WebServer/Documents">
to
DocumentRoot "/Users/YOUR_USERNAME/Sites" <Directory "/Users/YOUR_USERNAME/Sites">
YOUR_USERNAME being your user name.
3, Now while still in the config file we need to let the server know it has permission to access the files in the sites directory in your user home directory.
ctrl + w again and search for
_www
change the two lines:
User _www
Group _www
to
User YOUR_USERNAME Group staff
I have also enable PHP on mine so I can test projects with php scripts.
If you want to do this:
ctrl + w again and search for
LoadModule php
uncomment the line
LoadModule php5_module libexec/apache2/libphp5.so
.
by removing the hash #
If you are happy with what you have done the save the changes using
ctrl + x keys.
then
y then hit the enter key
4, go to you home folder and add a new folder named sites . This will be where you your server files will be read from.
Inside the sites folder add another folder named scripts
Place your jQuery file inside that.
5, start the web server.
In Terminal.app
type:
sudo apachectl start
This will start the server. ( To stop the server sudo apachectl stop
)
You website address should be http://localhost/
If you enter this in your browser you should get a web page that displays the Apache server test page with the text:
It works!.
Now you can simply add to the head.
<script type="text/javascript" src="http://localhost/scripts/jquery.min.js"></script>
and it should work when previewing from Hype or an exported project.
When you then put it in word press there will be an error : [Error] Failed to load resource: Could not connect to the server. (jquery.min.js, line 0)
But that should not stop anything from working as far as I am aware.
Warning disclaimer:
I have not played with the built in web server much so I cannot tell you about the pros and cons of having it running like this. ( safe/ unsafe ) But I suspect it is not an issue… but everything you do here goes with the usual “You Do at your own risk” and can be researched on the web to your hearts content.
As I have mentioned above the added bonus for me is I can add projects to the sites folder for which I want to test php or load files out side of the hype resource folder.
This allows me to do quick tests without having to load up to my real site.
I hope this helps.