ASP.NET MVC - @Import LESS variables returned from controller -
i attempting return less variables in response asp.net mvc controller method -- @imported body of less file. purpose allow users customize appearance of of multi-tenant web application.
this works.
public class stylecontroller : controller { // get: style public string index() { var responseless = new stringbuilder(); responseless.appendline("@color1: red!important;"); responseless.appendline("@color2: green!important;"); response.contenttype = "text/css"; return responseless.tostring(); } ... };
the sample.less file imports response of above controller...
@color1: yellow!important; @color2: lime!important; h1 { color: @color1; } h2 { color: @color2; } @import (less) url('http://localhost:50274/style/index');
also in bundleconfig.cs, include following include less files...
bundles.add(new stylebundle("~/content/less").include("~/content/*.less"));
i had define variables @color1 , @color2, otherwise error variables not exist.
i can see in chrome debugger network monitor stylecontroller index method returns response expect -- less variables. however, less apparently not recognizing variables; doesn't consider response valid less.
what missing or misunderstanding?
thanks, rod early
Comments
Post a Comment