Skip to content

Instantly share code, notes, and snippets.

@triptych
Forked from ItsAsbreuk/directory-structure
Created February 6, 2014 17:56
Show Gist options
  • Select an option

  • Save triptych/8849282 to your computer and use it in GitHub Desktop.

Select an option

Save triptych/8849282 to your computer and use it in GitHub Desktop.
You must download the yui3-files (for every version you want to serve) as well as the Gallery-modules.
Yui3 --> http://yuilibrary.com/yui/quick-start/ or https://github.com/yui/yui3
Gallery --> download zip from https://github.com/yui/yui3-gallery
The Gist presumes the next directory-structure on the server:
/usr/local/yui_libraries/
/usr/local/yui_libraries/yui3/
/usr/local/yui_libraries/yui3/3.10.3/...
/usr/local/yui_libraries/yui3/3.11.0/...
/usr/local/yui_libraries/yui3-gallery/
/usr/local/yui_libraries/yui3-gallery/gallery-2013.06.05-22-14/...
/usr/local/yui_libraries/yui3-gallery/gallery-2013.07.03-22-52/...
/usr/local/yui_libraries/custom-gallery/
/usr/local/yui_libraries/custom-gallery/0.0.1/...
/usr/local/yui_libraries/custom-gallery/0.0.1/...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Example</title>
<script type="text/javascript" src="http://loader.yourdomain.com/yui3/3.11.0/build/yui/yui-min.js"></script>
<link rel="stylesheet" type="text/css" href="http://loader.yourdomain.com/yui3/3.11.0/build/cssreset/cssreset-min.css">
</head>
<body class='yui3-skin-sam'>
<div id="demo"></div>
<script>
var loaderdomain = 'http://loader.yourdomain.com',
yui3version = '3.10.0',
galleryversion = 'gallery-2013.07.03-22-52',
customgalleryversion = '0.0.1',
combine = true,
yuiconfig = {
base : loaderdomain+'/yui3/'+yui3version+'/build/',
comboBase: loaderdomain+'/combo?',
combine : combine,
root : 'yui3/'+yui3version+'/build/',
groups : {
gallery : {
combine : combine,
base : loaderdomain+'/yui3-gallery/'+galleryversion+'/build/',
comboBase: loaderdomain+'/combo?',
root : 'yui3-gallery/'+galleryversion+'/build/',
patterns:
{
'gallery-': { },
'lang/gallery-': { },
'gallerycss-': { type: 'css' }
},
update: function() { }
},
customgallery : {
combine : combine,
base : loaderdomain+'/custom-gallery/'+customgalleryversion+'/build/',
comboBase: loaderdomain+'/combo?',
root : 'custom-gallery/'+customgalleryversion+'/build/',
patterns:
{
'custom-': { },
'lang/custom': { },
'customcss': { type: 'css' }
},
update: function() { }
}
}
};
YUI(yuiconfig).use('slider', 'gallery-itsadialog', function(Y) {
var slider = new Y.Slider().render('#demo');
Y.confirm('does it work?'); // Y.confirm comes from 'gallery-itsadialog'
});
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Example</title>
<script type="text/javascript" src="https://loader.yourdomain.com/yui3/3.11.0/build/yui/yui-min.js"></script>
<link rel="stylesheet" type="text/css" href="https://loader.yourdomain.com/yui3/3.11.0/build/cssreset/cssreset-min.css">
</head>
<body class='yui3-skin-sam'>
<div id="demo"></div>
<script>
var loaderdomain = 'https://loader.yourdomain.com',
yui3version = '3.10.0',
galleryversion = 'gallery-2013.07.03-22-52',
customgalleryversion = '0.0.1',
combine = true,
yuiconfig = {
base : loaderdomain+'/yui3/'+yui3version+'/build/',
comboBase: loaderdomain+'/combo?',
combine : combine,
root : 'yui3/'+yui3version+'/build/',
groups : {
gallery : {
combine : combine,
base : loaderdomain+'/yui3-gallery/'+galleryversion+'/build/',
comboBase: loaderdomain+'/combo?',
root : 'yui3-gallery/'+galleryversion+'/build/',
patterns:
{
'gallery-': { },
'lang/gallery-': { },
'gallerycss-': { type: 'css' }
},
update: function() { }
},
customgallery : {
combine : combine,
base : loaderdomain+'/custom-gallery/'+customgalleryversion+'/build/',
comboBase: loaderdomain+'/combo?',
root : 'custom-gallery/'+customgalleryversion+'/build/',
patterns:
{
'custom-': { },
'lang/custom': { },
'customcss': { type: 'css' }
},
update: function() { }
}
}
};
YUI(yuiconfig).use('slider', 'gallery-itsadialog', function(Y) {
var slider = new Y.Slider().render('#demo');
Y.confirm('does it work?'); // Y.confirm comes from 'gallery-itsadialog'
});
</script>
</body>
</html>
<VirtualHost *:80>
# local comboloader for yuimodules, gallerymodules and custom modules
# both comboloader and non-combo. Service runs on port 5010
# every domain can have a copy of this Virtual Host
# FOR EVERY VIRTUALHOST-COPY YOU NEED TO CHANGE:
# Servername and ServerAlias and SUBDOMAIN of the first RewriteCond
# you might need to define a ssl-definition as well
ServerName loader.yourdomain.com
ServerAlias loader.yourdomain.com
DocumentRoot "/usr/local/yui_libraries"
<IfModule proxy_module>
RewriteEngine on
# first: is cross side request --> block it
RewriteCond %{HTTP_REFERER} !^http://([^.]+\.)*yourdomain\.com/
RewriteCond %{HTTP_REFERER} !^$
RewriteRule (.*) - [F,L]
# next: if combo request: use comboloader on port 5010
RewriteCond %{REQUEST_URI} ^/combo
RewriteRule (.*) http://localhost:5010$1 [P]
</IfModule>
</VirtualHost>
# replace 999.999.999.999 with the right ip
<VirtualHost 999.999.999.999:443>
# local comboloader for yuimodules, gallerymodules and custom modules
# both comboloader and non-combo. Service runs on port 5010
# every domain can have a copy of this Virtual Host
# FOR EVERY VIRTUALHOST-COPY YOU NEED TO CHANGE:
# Servername and ServerAlias and SUBDOMAIN of the first RewriteCond
# supply the right STAR_yourdomain_com.key and STAR_yourdomain_com.crt certificates that belong with the domain
ServerName loader.yourdomain.com
ServerAlias loader.yourdomain.com
DocumentRoot "/usr/local/yui_libraries"
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
<IfModule ssl_module>
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/httpd/certs/STAR_yourdomain_com.crt
SSLCertificateKeyFile /etc/httpd/certs/STAR_yourdomain_com.key
SSLCertificateChainFile /etc/httpd/certs/AddTrustExternalCARoot.crt
SSLCertificateChainFile /etc/httpd/certs/PositiveSSLCA2.crt
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</IfModule>
<IfModule proxy_module>
RewriteEngine on
# first: is cross side request --> block it
RewriteCond %{HTTP_REFERER} !^https://([^.]+\.)*yourdomain\.com/
RewriteCond %{HTTP_REFERER} !^$
RewriteRule (.*) - [F,L]
# next: if combo request: use comboloader on port 5010
RewriteCond %{REQUEST_URI} ^/combo
RewriteRule (.*) http://localhost:5010$1 [P]
</IfModule>
</VirtualHost>
# make sure you have:
# 1) install node.js
# 2) npm install -g combohandler
# 3) npm install -g forever
# then execute these commands from the shell (need to find a the right startup scripts to do this automaticly)
# 'forever' makes the script keep running as a daemon
export NODE_ENV=production
forever start /usr/local/lib/node_modules/combohandler/bin/cli.js --root /combo:/usr/local/yui_libraries --basePath / --port 5010
var loaderdomain = 'https://loader.yourdomain.com', // or 'https' in case of ssl
yui3version = '3.10.0',
galleryversion = 'gallery-2013.07.03-22-52',
customgalleryversion = '0.0.1',
combine = true,
yuiconfig = {
base : loaderdomain+'/yui3/'+yui3version+'/build/',
comboBase: loaderdomain+'/combo?',
combine : combine,
root : 'yui3/'+yui3version+'/build/',
groups : {
gallery : {
combine : combine,
base : loaderdomain+'/yui3-gallery/'+galleryversion+'/build/',
comboBase: loaderdomain+'/combo?',
root : 'yui3-gallery/'+galleryversion+'/build/',
patterns:
{
'gallery-': { },
'lang/gallery-': { },
'gallerycss-': { type: 'css' }
},
update: function() { }
},
customgallery : {
combine : combine,
base : loaderdomain+'/custom-gallery/'+customgalleryversion+'/build/',
comboBase: loaderdomain+'/combo?',
root : 'custom-gallery/'+customgalleryversion+'/build/',
patterns:
{
'custom-': { },
'lang/custom': { },
'customcss': { type: 'css' }
},
update: function() { }
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment