Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
Added configure support for yui-core@version passing
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Feb 15, 2011
1 parent b567b42 commit 52619a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/rls.js
Expand Up @@ -6,7 +6,7 @@ yui3.rls({
m: 'console',
//m: 'dd,widget,autocomplete,gallery-yql,yui2-datatable',
//env: 'node,attribute',
v: '3.3.0',
//v: 'yui3-core@3.2.0',
//v: '3.2.0',
gv: '2010.09.22',
//parse: true, //This parses the file content and returns it as the last arg
Expand Down
17 changes: 13 additions & 4 deletions lib/yui3-yui3.js
Expand Up @@ -22,7 +22,7 @@ exports.configure = function(c) {
if (!c[i]) {
c[i] = defaultConfig[i];
}
if (c[i] !== '' && (c[i].indexOf('@') !== 0)) {
if (c[i] !== '' && (c[i].indexOf('@') === -1)) {
c[i] = '@' + c[i];
}
}
Expand All @@ -34,7 +34,7 @@ exports.configure = function(c) {

var oldConfig = false;
//This old version requires a different config parser..
if (c.core === '@3.2.0') {
if (c.core.indexOf('@3.2.0') !== -1) {
oldConfig = true;
}

Expand All @@ -47,7 +47,12 @@ exports.configure = function(c) {

try {
//Try to load the YUI3-core module
var yui3 = require('yui3-core' + c.core);
var core = 'yui3-core' + c.core;
if (c.core.indexOf('@') > 0) {
core = c.core;
}
console.log('Core: ', core);
var yui3 = require(core);
var YUI = yui3.YUI;
} catch (e) {
throw new Error('YUI3 Core package was not found; npm install yui3-core');
Expand All @@ -56,7 +61,11 @@ exports.configure = function(c) {

try {
//Load Gallery
gallery = require('yui3-gallery' + c.gallery).path();
var gv = 'yui3-gallery' + c.gallery;
if (gv.indexOf('@') > 0) {
gv = c.gallery;
}
gallery = require(gv).path();
} catch (e) {}

try {
Expand Down

0 comments on commit 52619a1

Please sign in to comment.