totaljs / framework4

Total.js framework v4
https://www.totaljs.com
Other
99 stars 36 forks source link

default_root Error #24

Closed KangGeunSu closed 2 years ago

KangGeunSu commented 2 years ago

hello, I'm testing 'default_root'.

I think this part is wrong

utils.js

function $urlremap(text) {
    var pos = text[0] === 'h' ? 6 : 5;
    return REG_URLEXT.test(text) ? text : ((text[0] === 'h' ? 'href' : 'src') + '="' + CONF.default_root + (text[pos] === '/' ? text.substring(pos + 1) : **text**));
}

function $urlremap(text) << text is href="@{R.url}img/icon.png" var pos = text[0] === 'h' ? 6 : 5; << pos is 6 return ..... (text[pos] === '/' ? text.substring(pos + 1) : text) <<< text[pos] is @ => false valus is text

but text is href="@{R.url}img/icon.png" I think you should cut off 'href or src' of 'text'.

return ..... (text[pos] === '/' ? text.substring(pos + 1) : text.substring(pos))

Thank you!

petersirka commented 2 years ago

Fixed. The framework will skip paths starting with external links or with a ViewEngine command.

KangGeunSu commented 2 years ago

It wasn't what I wanted.

default_root is null main page uri /

default_root is kgs main page uri /kgs

this is good

But 'js' or 'css' doesn't seem to be called '/js/kgs.js'.

Shouldn't it be called 'kgs/js/kgs.js'?

My method is called like this: kgs/js/kgs.js

Also, 'flow' is applied.(Except for 'theme'..., need some correction) I'm sorry if you feel bad..

Thank you

petersirka commented 2 years ago

Please, make a simple example that I can test and where will be the mentioned issue.