injecting php variables into lessphp 0.3.8 - variables

I am trying to inject some php variables into my less css using the method described in the lessphp docs. I can do:
$lc = new lessc;
$lc->setVariables(array("stylesheetURI" => "foo/bar"));
Which ultimately allows me to do:
background-image: url("#{stylesheetURI}/img/logo.jpg");
Which results in:
background-image: url("foo/bar/img/logo.jpg");
Thats all perfect & works like a charm ...
However I'd prefer to add a full URL to my image paths. So I am doing:
$lc = new lessc;
$lc->setVariables(array("stylesheetURI" => "http://mydomain.com/foo/bar"));
But that results in:
background-image: url("http/img/logo.jpg");
Which is clearly wrong. Has anyone else seen this issue? I've had a dig around in the lessc.inc.php class but it's a bit of a beast and I haven't managed to locate the problem. I presume its related to the colon - do anyone know how to escape this? I've tried a backslash but that doesn't work.
Thanks all

I try
$less = new lessc;
$less->setVariables(array(
'rdir'=> '"/resources/default"'
));
echo $less->compileFile($lessFileName);
im less file I have
img{
background-image: url(#{rdir}/img.jpg);
}
in output I have:
img {
background-image: url(/resources/default/img.jpg);
}
when I try
$less->setVariables(array(
'rdir'=> '"http://example.com/resources/default"'
));
I get
img {
background-image: url(http://example.com/resources/default/img.jpg);
}
lessphp v0.3.9
you can try add string variable with quotes '"http://example.com/"'

Related

antd.customize.less trouble with font-family (help please)

Hi I have a trouble with changing font-family. I have local font I need to use it. But is doesn't work, what I missing?
It seems you added an additional : after #font-face. You should use it like this:
#font-face {
font-family: 'font-name';
src: url('url');
...
}

Component variable in variables.scss doesn’t work

I wrote the code below in the file of “variables.scss” or “global.scss”:
ion-searchbar {
–placeholder-color: white;
–placeholder-opacity:1;
–icon-color:white;
}
it should make the text of placeholder with white color, however, it doesn’t work.
But, if I write the code just in the page css file, it does work.
Does somebody know why?
You have to put it within the :root pseudo selector, like this:
:root {
ion-searchbar {
--placeholder-color: white;
–-placeholder-opacity: 1;
–-icon-color: white;
}
}
This will ensure that any variables you set inside of :root will apply across your entire application.

Unable to set the colour for gxt-TextField in IE

I'm not able to set the background color for the textfield in GXT. I have used
textfield.setStyleName("backgroung-color:red;")
textfield.setStylePrimaryName("backgroung-color:red;")
But it is not working in IE. How can i do this ?
The function "setStyleName()" is not working as you expect, it sets the component class name. You can create a style class with name for example 'field-bgColor' in your css file like:
.field-bgColor {
background-color: red;
}
after that, you would use it like following:
textfield.setStyleName("field-bgColor");
Or you can use "setStyleAttribute()" function like:
textfield.setStyleAttribute("backgroundColor", "red");
Hope it works for you :)

Dojo (Dijit) bordercontainer does not show correctly (programatically)

I tried to do a layout using dijit in dojo (1.7.2), but the result did not looks like the way I intended.
My first attempted is trying a declarative style from some example (here http://pastebin.com/Uy0pFmn3), which worked fine. Then I tried to convert it to programatic style (here http://pastebin.com/qRWUQsQN ), but it only showed the layout that created last.
Did I do misunderstanding how the dijit's layout works or just some minimal overlook here ?
thanks
You must add CSS styles:
html, body {
height: 100%;
width: 100%;
}
and for BorderContainer:
style="height:100%; width:100%"
EDIT: ok I got it. I guess I cannot use new ContentPane but instead, new dijit.layout.ContentPane (So here the finalize version http://pastebin.com/eYfeQUd8). The weird, "show only last layout" cause by my weird CSS stuff.
One thing that puzzled me is that why new ContentPane did not work ? As far as I recall, some example did like this
require(["dijit/layout/BorderContainer", "dijit/layout/TabContainer",
"dijit/layout/ContentPane"], function(BorderContainer) {new BorderContainer //STUFF//}
I see the problem here..
In your pastebin code you are missing do declare the function paramter like the below example...
Your modified code:
require(["dijit/layout/BorderContainer", "dijit/layout/TabContainer",
"dijit/layout/ContentPane"], function(BorderContainer, TabContainer, ContentPane ) {
var appLayout = new BorderContainer({"design": "headline"}, 'appLayout');
Also the order of the require paramters should match inside the function parameters also ..
Waseem Ahmed V

Can a mixin refer to values in the calling selector?

For example, I would like to be able to do this:
.bigfirstletter(#mag) {
&:first-letter {
font-size: [get_original_font_size] + #mag;
}
}
But as far as I can see I have to do this, which is not as neat
.bigfirstletter(#fontsize, #mag) {
&:first-letter {
font-size: #fontsize + #mag;
}
}
Do I have an alternative? Thank you for your help.
damn it was simpler than I thought :)
.bigfirstletter(#mag) {
&:first-letter {
font-size: 1em * #mag;
}
}
1em will simply inherit whatever it is defined for element, and you just set your magnification. I changed the plus sign to multiply on purpose as with this you're going to have better control over font size - #mag=1.0 for same font size, #mag=1.5 for 50% bigger, and so on..
sorry about the answer below, for some reason I didn't see that you're using first-letter in the example provided (doh!)
take a look at :first-letter CSS pseudo class - here