Giter Site home page Giter Site logo

Compatibility with MVC about skel HOT 5 CLOSED

brandonam avatar brandonam commented on June 16, 2024
Compatibility with MVC

from skel.

Comments (5)

ajlkn avatar ajlkn commented on June 16, 2024

Try setting the prefix to something absolute like '/css/style', then set up your routing so it ignores anything in '/css/'.

from skel.

brandonam avatar brandonam commented on June 16, 2024

Hi n33,

Thank you for your suggestion I've been experimenting with this but unfortunately not having much luck :(

I've been using absolute paths e.g. /css/style, ../../css/style. But I either lose the styling on the landing page once published or on the {controller}/{action} pages. If I use the first absolute path example above, the landing page works fine, but any navigation to another controller, once published to IIS looks in the controller/action virtual folder like so http://servername/applicationname/controller/action/css/style.css rather than http://servername/applicationname/css/style.css. For the other example above the landing page breaks as instead of serving http://servername/applicationname/css/style.css it instead serves http://servername/css/style.css

I've tried using the ignore route as you suggested routes.IgnoreRoute("{whatevercontrollername}/{whateveractionname}/"), but no luck there either unless I'm using it incorrectly?

Any help would be greatly appreciated!

from skel.

ajlkn avatar ajlkn commented on June 16, 2024

Odd. That doesn't make a whole lot of sense. When you set a prefix in
skelJS, say:

prefix: '/css/style'

It's equivalent to prefixing every stylesheet the client looks for
with /css/style, ie.

...

In other words, it's purely client side. If that's not working,
something on the server side might be screwing with your configuration
(like remapping anything that looks like a route).

On 11/21/2013 8:36 AM, brandonam wrote:

Hi n33,

Thank you for your suggestion I've been experimenting with this but unfortunately not having much luck :(

I've been using absolute paths e.g. /css/style, ../../css/style. But I either lose the styling on the landing page once published or on the {controller}/{action} pages. If I use the first absolute path example above, the landing page works fine, but any navigation to another controller, once published to IIS looks in the controller/action virtual folder like so http://servername/applicationname/controller/action/css/style.css rather than http://servername/applicationname/css/style.css. For the other example above the landing page breaks as instead of serving http://servername/applicationname/css/style.css it instead serves http://servername/css/style.css

I've tried using the ignore route as you suggested routes.IgnoreRoute("{whatevercontrollername}/{whateveractionname}/"), but no luck there either unless I'm using it incorrectly?

Any help would be greatly appreciated!


Reply to this email directly or view it on GitHub:
#21 (comment)

from skel.

brandonam avatar brandonam commented on June 16, 2024

I do agree it definitely is something to do with the way IIS does the routing with the virtual path, I just cant figure out what or why it does it that way. I've found a sloppy hack in the mean time

function getRootWebSitePath()
{
var location = document.location.toString();
var applicationNameIndex = location.indexOf('/', location.indexOf('://') + 3);
var applicationName = location.substring(0, applicationNameIndex) + '/';
var webFolderIndex = location.indexOf('/', location.indexOf(applicationName) + applicationName.length);
var webFolderFullPath = location.substring(0, webFolderIndex);
return webFolderFullPath;
}
var rootDir = getRootWebSitePath();

and then appending rootDir to the prefix like so "prefix: rootDir + '/css/style'" this at least works when deployed live, while working locally I have to use ../../css/style as that's the only way the css will load across all views.

from skel.

ajlkn avatar ajlkn commented on June 16, 2024

A pity, but at least it works. Still, I find it unusual IIS would mangle paths in this manner (particularly absolute ones, as that's bound to break stuff elsewhere).

from skel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.