Is it possible to call a javascript function with less variable from less css?

后端 未结 1 566
清歌不尽
清歌不尽 2021-01-25 07:12

I have to call a javascript function from the less css for customization purpose. The function needs to pass the less variable from less file to js. is it possible to do it? usi

相关标签:
1条回答
  • 2021-01-25 08:05

    You can embed javascript in lesscss files with backticks.

    For example:

    @myObject: `function(){
    
        var myObject = {
            getSomething: function() {
                return( "This is yo' content!" );
            }
        };
    
        return( myObject );
    
    }`;
    

    Notice the backticks (not single quotes).

    0 讨论(0)
提交回复
热议问题