Passing parameters to less file in command line - dotless

I am using dotless.compiler.exe in my solution and passing below command in post build event of solution properties.
$(SolutionDir)\packages\dotless.1.1.0\Tools\dotless.Compiler.exe -m "$(ProjectDir)\content*.less" "$(ProjectDir)\content*.css"
My Question is can I pass some parameters to less files in this command ?

AFAIK the answer is no. Dotless compiler does not allow you to pass variables in. The only way you can pass variables into a less file is via a querystring parameter when you directly reference to the less file in your page.
Example
<link rel="stylesheet" href="styles.less?bacon=true" />

Related

TeamCity parameter specification referring to another parameter?

I am using the latest version of TeamCity and I am trying to make a parameter specification that refers to parameters.
I tried making a select (combobox), where the options of the checkbox are referring to variables. This should be possible, as there is a "parameter" icon to the right of the box suggesting me that I can use parameters here.
The full setup is shown below.
However, when I want to run the build, the only options are literally %foo% and %bar% as if the parameters have not even been evaluated.
Instead I had expected the options to contain the values of the variables that they are pointing to.
What am I doing wrong here?
Might be a bit late, but this is how I did it:
I have a few parameters for holding passwords, e.g. 'mfgpwd'
And I refer to these in another parameter using the syntax:
mfgpwd=%system.mfgpwd%
(I'm using TeamCity 8.1.5)

loading macro files in a directory, transparently

I am looking for a way to separate the repetitive html codes from web pages, and for this I am planning to use the macro functionality. The problem here is for every macro I need to put this macro in a file, or put some of them in a file and include this in the template file.
What I need is to include once just the directory name something like
<#import "/tags/widgetDirectory" as widgets />
here the /tags/widgetDirectory is a directory , and every files here can be seen as a macro defined.
when I need to insert a code part from a file from this directory lets say slide.ftl I will just use
<#widgets.slider />
the system will check for slider.ftl in the /tags/widgetDirectory directory . here the slider.ftl can have <#macro> as first and as last line , or these can transparently added and system can load it as a macro
this will easy my designer work.
Maybe there is better way for doing this kind of widgets/components based web design ?
best regards,
This feature (importing directories) is something that's planned for FM actually... but it won't happen anytime soon. But I guess it can be solved fairly well with a hack right now. Instead of #import, use your own TemplateMethodModelEx, that you could use like <#assign widgets = importDirectory('/tags/widgetDirectory') >. This will return a TemplateHashModel that's also implemented by you and is bound to the directory path. When an item of that hash is get, it uses Environment.getCurrentEnvironment().include. The included file is expected to create a macro with name __main or something. So then you get that variable with Environment.getCurrentNamespace().get("__main") and return it as the result of the hash lookup. Of course this hash should also maintain a cache, so that if the same item is get twice, it wont include the template for the second time, just return the macro extracted earlier. This can be developer further, so that if the include file didn't define __main, then it's supposed that it prints directly to the output, and so it will be included again, when the "tag" is called again.

what is the precedence for chef/knife bootstrap json attributes

The documentation for Chef attribute precedence is here: https://docs.getchef.com/chef_overview_attributes.html
However, the docs don't really explain what level is applied to attributes that are passed in via the -j flag for the knife bootstrap command.
The reason why I'm asking is because I'm passing in attributes and some of those attributes aren't being applied correctly to my run.
Stuff passed in via -j are set as the node data, which are the normal/set level.
As #coderanger pointed out, they should be at the set level if you are formatting your json correctly. If your Json isn't formatted correctly, it won't set the values at all, but may not give you an error.
For troubleshooting, you can use node.debug_value to see the whole attribute tree.
Or if you want a shortcut, use the spicerack cookbook's print_attribute_debug recipe to grab it and print it. The cookbook as a whole is still really immature, but the README gives the usage details and it's plenty good for debugging purposes.

Can I use environment variables in vim keyboard mappings?

There's probably a better way to do this, but this is what I'm trying to do. I have several html files for which I need to update meta tags prior to updating the content. I'm trying to automate this by using a keyboard mapping similar to what follows:
nnoremap <leader>mt /<meta name="developer"<cr>f";;lct"$username
This seems to work with the exception of the $username portion. How can I make the mapping evaluate the variable?
I do have a few tags to update per page, but don't know how else to do this. If someone has a better method, I'd be more than happy to hear it. The content that I'm searching through is similar to the following:
<meta name="owner" content="someowner">
<meta name="developer" content="somedev">
<meta name="date" content="2012-07-26">
<meta name="expires" content="2013-07-26">
The date would be the date that I opened the file to edit, while the expires would be one year from the date
NOTE: This is gvim on Windows if that changes things.
$username does refer to the environment variable username, but to use this in a mapping, you have to stick to the (somewhat unintuitive, but perfectly consistent) interpretation rules of Vim.
The ct" mean change until double-quote, so what follows is in insert mode. To insert an environment variable (or any other Vim expression), use <C-R>=:
nnoremap <leader>mt /<meta name="developer"<cr>f";;lct"<C-R>=$username<CR>
This will evaluate the environment variable on each mapping invocation. (And stay in insert mode; append <Esc> to go back to normal mode!) Alternatively, you could also bake the value into the mapping itself:
execute 'nnoremap <leader>mt /<meta name="developer"<cr>f";;lct"' . $username
I don't know if this is the best solution, but for the user name on a unix machine you can call the 'whoami' command as external command from vim and store it's return value in a variable for later reuse
For the dates, there is a strftime() function in vim. You could add an auto command for the VimEnter event and store the time/date at that moment in a variable too, to reuse it later.

Using Apache and mod_ext_filter, need to dynamically replace values of static file based off of query string

I've got a situation where I need to alter the contents of a cached file based off of one of the query string arguments passed in. I'd love to use sed to do a simple regular expression replacement of a value based off of said argument but I can't figure that one out. I could use a ruby script to do the replacement for me but can't seem to access the query string for the request within the script. The documents for mod_ext_filter say:
In addition to the standard CGI environment variables, DOCUMENT_URI, DOCUMENT_PATH_INFO, and QUERY_STRING_UNESCAPED will also be set for the program.
Um yeah, can't seem to access those.
Has anybody any experience with this or does anybody have a better solution?
Doh! Looks like I simply need to access the ENV variable within ruby. Pretty dumb of me.
Using PHP scripting language server function we can able to get the query string values.
echo $_SERVER['REQUEST_URI'];
And pass the URL arguments as a variable to the file and make it dynamic.
Refer : PHP.net

Resources