javascript - Create and use user functions in lesscss -
i have in html:
<script type="text/javascript"> less = { env: "development", // or "production" async: false, // load imports async fileasync: false, // load imports async when in page under // file protocol poll: 1000, // when in watch mode, time in ms between polls functions: { returncenter: function (value, context) { return 'center'; } }, // user functions, keyed name dumplinenumbers: "comments", // or "mediaquery" or "all" relativeurls: false,// whether adjust url's relative // if false, url's relative // entry less file rootpath: ":/a.com/"// path add on start of every url //resource }; </script> <script src="less.js" type="text/javascript"></script>
so in functions, how can create , use functions in less file?
thanks , luck!
p.d. returncenter, doesn't work. or without parameters.
for reason should write function names in lowercase. should function return proper type.
try:
<script> less = { env: "development", functions: { returncenter: function(context, value) { return new(less.tree.anonymous)('center'); } } }; </script>
now can use following less code:
selector { property: returncenter(); }
the preceding less code compile following css code:
selector { property: center; }
nb see: user defined functions lesscss?
Comments
Post a Comment