LESSC source maps not working - css

I'm running lessc as following:
lessc alice/public/local/less/intfarm.less > alice/public/local/css/local/compiled/intfarm.css --source-map=alice/public/local/less/intfarm.map --verbose
the source map is output but it doesn't work. I check the file and at the end I read:
...
,iBAAA;EACA,cAAA;;AA1EZ,IAAI,SA8EA;EACI,gBAAA","file":"../../../../undefined
do I need to set other flags as well?
(shoutout at LESS creators: why not enable this by default and save us hours of work and searching?)

You should not use the > between your source and destiny. In fact your send the output to stdout. The compiler don't know that you are writing the output to intfarm.css and so can not construct the source map link to that file.
Also see: https://github.com/less/less.js/pull/2389

another solution can be using --source-map-map-inline parameter instead of --source-map=... but I think the best solution is the one pointed by Bass Jobsen

Related

shell function doesn't work in subfolder?

I have the following code that should open the Recode.xlsx inside the subf folder but doesn't
write_xlsx(mtcars, "subf/Recode.xlsx")
shell("subf/Recode.xlsx", wait=FALSE)
The following code works, so if anyone has an idea on why it doesn't work it would help me
write_xlsx(mtcars, "Recode.xlsx")
shell("Recode.xlsx", wait=FALSE)
Here’s what the documentation of the shell function says (emphasis mine):
shell is a more user-friendly wrapper for system. To make use of Windows file associations, use shell.exec.
And here is another bit of relevant information from the shell.exec documentation:
To be interpreted as relative, the path also needs to use backslashes as separators (at least in Windows 10).
So the following is the correct usage:
shell.exec("subf\\Recode.xlsx")

How to set custom filename for pabot result (html)

I implemented test cases for my application and decided to run it everyday. The problem is the result of the previous test will be overwritten by the latest test result. I need to keep them both so I came up with a solution that include the test date and time in the report name, for example; report-202111181704.html (use time in 24-hour format).
I searched through the internet and did not found any solution yet. Anybody here know the solution? or any alternative solution will be fine.
It depends on where you execute your tests. From command line you can save the date to variable. Then use this variable to change the name of generated outputs. For example
date=$(date '+%Y-%m-%d_%H:%M:%S')
robot --output ${date}output.xml --log ${date}log.html --report ${date}report.html test.robot
I found the solution. Instead of setting .html file name, I create a folder and put the result there.
To do this, add --outputdir in pabot command so it's gonna look like this
pabot --pabotlibport $PABOT_PORT --pabotlib --resourcefile ./DeviceSet.dat --processes $thread --verbose --outputdir ./result/$OUTPUT_DIR $ENV
where
$OUTPUT_DIR=`date + "%Y%m%d-%H%M"`
The output folder gonna be like ./result/20220301-2052

Access file name (extension) with READNULLCMD

A nice shortcut in Zsh for catting files is, with Python file type for example:
<somefile.py
But it's much nicer if that file is syntax-highlighted. So the trick is to use a tool like bat instead of the default cat:
READNULLCMD=bat
This actually works when a shebang is present since Bat will look for it. BUT, the file type detection by extension might not be possible since the input is simply seen as STDIN. And since most files don't have a shebang line, file name extension is a necessary fallback in order to detect file type.
There is this method for debugging READNULLCMD, using a function. I've tried wrapping in set -x, grepping env, etc, but not finding a way to see the name. If I could see the name, then something like this could be used:
mynullcmd() { bat -l $stdin_filename:x } # get extension and use as file type
READNULLCMD=mynullcmd
Question: Is there some way for Zsh to know what's being passed in as STDIN? Can it know that the command contained somefile.py?
Settle for an alias, like c is short for cat equivalent:
alias c=bat
c somefile.py
Other viable highlighters include coderay and pygmentize, but I've found bat to be the most capable in speed and breadth of language support.

Failed to create wallet for ton with Fift?

Right now I'm trying to create wallet for TON.
I downloaded and built Fift interpreter an was trying to create new wallet with: ./crypto/fift new-walelt.fif
[ 1][t 0][1559491459.312618017][fift-main.cpp:147] Error interpreting standard preamble file `Fift.fif`: cannot locate file `Fift.fif`
Check that correct include path is set by -I or by FIFTPATH environment variable, or disable standard preamble by -n.
Although my path variable is set. Could anyone please help me with this?
First, locate {{lite-client-source-direcotry}}/crypto/fift
This is not the build directory, that's the directory where are the source files (lite-client that you downloaded). So verify you have that it contains Fift.fif file.
If you installed it in the user working directory, it should be:
~/lite-client/crypto/fift/
Now, you should either set FIFTPATH variable to point to this directory or run fift with -I option:
export FIFTPATH=~/lite-client/crypto/fift/
./crypto/fift new-walelt.fif
Or
./crypto/fift -I~/lite-client/crypto/fift/ new-walelt.fif
Have you tried ./crypto/fift -I<source-directory>/crypto/fift new-wallet.fif instead of setting environment variable? Are Fift.fif and Asm.fif library files inside FIFTPATH?
Make sure you have followed all the instruction written here:
https://test.ton.org/HOWTO.txt
It should work if you do all the above instruction correctly. If not, it might be a bug. Remember that TON is in a very early beta strage. You can submit the issue here:
https://github.com/copperbits/TON/issues
You also can use this:
cd ~/liteclient-build
crypto/fift -I/root/lite-client/crypto/fift/lib -s /root/lite-client/crypto/smartcont/new-wallet.fif -1 wallet_name
Try this (worked for me)
export FIFTPATH=~/lite-client/crypto/fift/lib
./crypto/fift new-wallet.fif

Is there an app to automatically format CSS files?

I have a compressed CSS file (all whitespace removed) that I want to inspect, but it's a huge pain inspecting it as-is. Is there any utility (preferably linux command line) that I can run the file through to format it nicely?
The online service that Dave Newman mentioned has been converted into a Node.js script, which you can run on the command-line. If you have NPM installed you can just do:
npm install -g cssunminifier
And it’s pretty versatile how you can use it. Here are 3 different examples:
cssunminifier style.min.css style.css
cssunminifier --width=8 style.min.css
curl http://cdn.sstatic.net/stackoverflow/all.css | cssunminifier - | less
Here’s more info on the command-line css unminifier
Try this online service.
You can also inspect any compressed file in Firebug.
I wrote a little formatter in Ruby for you. Save it as some .rb file and use it via CLI like ruby format.rb input.css input-clean.css:
#Formats CSS
input, output = ARGV
#Input
if input == nil or output == nil
puts "Syntax: #{$0} [input] [output]"
exit
end
#Opens file
unless File.exist? input
puts "File #{input} doesn't exist."
exit
end
#Reads file
input = File.read input
#Creates output file
output = File.new output, "w+"
#Processes input
input = input.gsub("{", "\n{\n\t")
.gsub(",", ", ")
.gsub(";", ";\n\t")
.gsub(/\t?}/, "}\n\n\n")
.gsub(/\t([^:]+):/, "\t" + '\1: ')
#Writes output
output.write input
#Closes output
output.close
These programs are called 'beautifiers'. You should be able to google one that fits for you.
If you're looking for a locally-executable utility, as opposed to a web service, you want CSS Tidy.
This also indents: styleneat
Here's a free windows app to "beautify" your file. I haven't used it so I don't know how well it works.
http://www.blumentals.net/csstool/
It is specific, but Visual Studio does this on that file type. (by no means a generic solution to which you alude)
take a look at the vkBeautify plugin
http://www.eslinstructor.net/vkbeautify/
It can beautify (pretty print) CSS, XML and JSON text,
written in plain javascript, small, simple and fast

Resources