undefined_methodError on less css code in phonegap

2019-08-21 07:28发布

I spend quite some time everyday on stackoverflow. This place is really great!

But this is my very first question, so every advice about it is very welcome :)

I'm working on a mobile app using phonegap. I use less css and it works fine on my nexus 5, but I have an error related to less on my old htc desire under android 2.2 :

undefined_methodError: Object function(a,b){return b instanceof Array?a=this.flatten(b,a):a.push(b),a} has no method 'bind'

in index.less on line null, column 0:

1 // Constants

The last line is the first line in my index.css file.

I've been looking on google and here for two days and I don't find anything.

Here is my index.html code:

<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet/less" type="text/css" href="app/index.less" />
        <script type="text/javascript" src="phonegap.js"></script>
        <script type="text/javascript" src="lib/async.js"></script>
        <script type="text/javascript" src="lib/jquery-1.8.2.min.js"></script>
        <script type="text/javascript" src="lib/handlebars.js"></script>
        <script>
            less = {
                log_level: 1
            }
        </script>
        <script type="text/javascript" src="lib/less-1.5.0.min.js"></script>
        <title>Kwali.to</title>
    </head>
    <body>

        <script type="text/javascript" src="app/index.js"></script>
    </body>
</html>

I need to "compile" the less code on the client because I have many sizes that are dependent to the screen resolution.

I really have no idea how to solve this and I hope it's not just a matter of incompatibility with my too old android...

How to solve this? What can I do to make my code work? Any help will be appreciated :)

Thank you guys!

1条回答
一夜七次
2楼-- · 2019-08-21 08:10

See "Less Browser Support". I.e. Less requires an ES-5 compatible JavaScript environment to run in. You can use es5-shim polyfill which will add the JavaScript features that Less requires.

查看更多
登录 后发表回答