Why does CURL JS not load my CSS file?

Good afternoon, I am experimenting with CurlJS and have been successful in most subjects. However, for some reason, I still cannot load the CSS file using CurlJS .

Firebug (net tab) shows their plugin css.jsas downloadable: which I assume is used to load CSS files. Firebug (console tab) shows that "a.load is not a function" from the file curl.js.

Version number for define.amd.curl: "0.6.2"

My question is: Why is the CSS file loading not loading?

MY CODE LOOKS LIKE:

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>

    <script type="text/javascript">
        curl =
        {
            baseUrl: '.',
            paths:
                {
                    curl: 'Scripts/Curl'
                    //,'css!':'Style' //<-- I even tried this with no success
                },
            pluginPath: 'Scripts/Curl/curl/plugin'
        };
    </script>

    <script src="Scripts/Curl/curl.js" type="text/javascript"></script>

    <script type="text/javascript">
        curl(['css!Style/Test.css'])
            .then(
            function (css) {
                if (css)
                    alert("It Works!");
            },
            function (error) {
                alert("It failed!");
            });
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div class="test" style="border: 1px solid black; text-align: center; width: 400px;">
            If the CSS loads this text will be RED.
        </div>
    </form>
</body>
</html>

CONSOLE TAB:
This is the screenshot from Firebugs Console

NET TAB:
This is the screenshot from Firebugs Net

:
JavaScript CSS , Curls.

var head = document.getElementsByTagName('head')[0];
var files = ['/Style/Test.css']; //<-- my list of files
for (var i = 0, l = files.length; i < l; i++) {
    var link = document.createElement('link');
    link.href = files[i];
    link.rel = "stylesheet";
    link.type = "text/css";
    head.appendChild(link);
}
+3
3

:

  • ($, css), "Test.css".
  • script. .

"a.load ", . - , .

[ :] , Firebug, : css.js /. . curl make utility css! , curl/dist, css! . .

+1

CurlJS, CSS.

:

curl(['css!Style/Test.css'])

:

curl(['css!./Style/Test.css'])

curl(['css!../../Style/Test.css'])
0

Use a different curl.js file ... the kitchen sink version includes plugins, while other versions do not.

https://github.com/cujojs/curl/tree/master/dist/curl-kitchen-sink

0
source

All Articles