I am trying to to compile a LESS file into a CSS one (both located in the same directory, same name).
The issue is that i keep getting:
1 A css file should begin with #charset 'UTF-8';
#import "color-theme.less"; // Line 4, Pos 2 #2 Stopping. (0% scanned).
// Line 4, Pos 2 [Finished in 0.3s]
I modifeid my .LESS file according to that, but to no avail. I even entered a simple statement such as:
body{
background-color: red;
}
and it still won't compile. Important note is that yesterday it was working, today it doesn't. I'm not sure what might've caused this.
I am using less2css, jsLint with Sublime Text 2.
The error message "A css file should begin with #charset 'UTF-8';" comes from JSLint.
It doesn't make a lot of sense to run JSLint on machine-generated CSS code. On the one hand it's going to find a lot to complain about (for example, whitespace); and on the other hand, the cleanliness of that code isn't very important – what matters most is the cleanliness of your handwritten LESS code instead.
Fwiw, you should be able to fix the charset warning by placing #charset 'UTF-8'; at the start of your LESS file – that should carry through to the generated CSS. It works in this simple example:
#charset 'UTF-8';
body {
background-color: red;
}
If you paste that into http://lesstester.com/, you'll get this CSS output:
#charset 'UTF-8';
body{background-color:red;}
But this already showcases how it's a losing battle: there's no charset warning anymore, but JSLint complains about the whitespace on the second line instead.
IMO your best option is to just ignore any JSLint warnings on the generated CSS file. If the Sublime JSLint plugin lets you designate certain files to ignore/exclude from linting automatically, even better.
Related
I have a question with VSCode. I developed tests with Cypress and VS didn't show any problem. In fact, this tests are working right now. However, VS Code shows a lot of stranges errors today. For example 'describe' is not defined. (no-undef)' or 'Expected indentation of 4 spaces but found 8. (indent)' as you can see in the image.
I did not change the VS Code Settings. Why is it happening?
UPDATE: I think the problem is the new version of Cypress 7.5, but i have not found a solution yet
I tried to fix that with this steps:
File / Preferences / Settings then Text Editor (or just search for 'tab' in the search settings box)
Then remove the tick from the following settings:
Insert Spaces
Detect Indentation
But it didnt' work. FInally, I had to remove the JS6 VS Extensions and this errors dissapeared.
That was My problem too, The exact error was:
Expected indentation of 4 spaces but found 6. eslint(indent)
And to fix that, I just let ESLint knows that "I don't want it to take care of those indentations".
There're two approaches for that (base on the eslint docs):
1. Using configuration comment
Put the following comment at the very top of each file you want that indentation to be ignored:
/* eslint-disable indent */
2. Using configuration file
To disable the indentation rule for a group of files (ex. test.js or spec.js), use the following code snippet in the .eslintrc file:
{
/* Whatever's here */,
"overrides": [
{
"files": ["*-test.js","*.spec.js"],
"rules": {
"indent": "off"
}
}
]
}
Use option + command + L can not format the less code in .vue file exactly in WebStorm.
You see the upper snapshot, it will format like the css.the .tag-model-mask block code should indent more 2 spaces.
The bellow is the settings of indent, I also don't think this affect the .vue file.
Afterwards I found the solution:
First config the Preferences-> Editor -> Code Style -> Less, I have done this:
Second, add the rel="stylesheet/less" property to the <script>:
<style lang="less" rel="stylesheet/less">
then format the file it will works.
When I attempt to compile a LESS template in Visual Studio using Web Essentials, I receive an error that says "Unexpected token u" with no file name, no line number, and no column number. Why is this happening?
Go to %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\12.0\Extensions which is the folder where per-user Visual Studio extensions reside. WebEssentials will be located in a subfolder with a randomly generated name.
From inside the WebEssentials folder, open up the file Resources\nodejs\tools\server\services\srv-less.js and go to line 65, which reads:
map = JSON.parse(output.map);
The problem is source map output may be the undefined value. JSON.parse can only parse strings, so it casts that to the string value "undefined" before parsing, but JSON does not recognize that as valid token. (It only understands the null value, not the undefined value.)
So... change line 65 to read:
map = JSON.parse(output.map || "null");
And voilà; LESS compilation on files with empty output works again.
Source:
https://github.com/madskristensen/WebEssentials2013/issues/1696
From my experience, this error occurs when LESS attempts to output a CSS file from a LESS file, and the resulting CSS file is empty. In my case, this happened after removing some font-face declarations, which left the resulting CSS file empty. LESS would not compile until I added a class that would output to the CSS file.
Details may be found here: https://github.com/madskristensen/WebEssentials2013/issues/1696
I'm adding this to StackOverflow because I'm unable to access Github at my workplace. I hope this helps someone.
You can also add in your less file an important comment /**/ or #charset "utf-8"; as described here https://github.com/madskristensen/WebEssentials2013/issues/1696
I'm attempting to convert latex to pdf, using doxygen generated latex files. I am using Doxygen 1.8.7. However, I keep getting this error:
!LaTex Error: Unknown float option 'H'.
...
1.6 \begin<figure>[H]
I've narrowed it down to a .tex file, which contains the following:
\hypertarget{group___a_m_s___common}{\section{A\+M\+S\+\_\+\+Common}
\label{group___a_m_s___common}\index{A\+M\+S\+\_\+\+Common#{A\+M\+S\+\_\+\+Common}}
}
Collaboration diagram for A\+M\+S\+\_\+\+Common\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=334pt]{group___a_m_s___common}
\end{center}
\end{figure}
\subsection*{Modules}
\begin{DoxyCompactItemize}
\item
\hyperlink{group___common___error___codes}{A\+M\+S Common Error Codes}
\end{DoxyCompactItemize}
\subsection{Detailed Description}
Where do I go from here? Am I right in saying that it's looking for an image that it can't find?
This does indeed seem to be an issue with the float package. I had the same problem. However, just adding EXTRA_PACKAGES=float didn't fix it for me. I finally found this page which describes a conflict between the fixltx2e package and the float package which generates this error about the unknown H option. So, I commented out line 11 where it says \usepackage{fixltx2e} in the doxygen generated tex file (called refman.tex for me). Then it converted to pdf without any further problems.
As the latex error says, it's not looping for an image it can't find, but rather encountered an option to a floating element it doesn't understand. The 'H' option for float placement forces a figure to appear exactly at the place it appears in the latex code and essentially not to float. It requires the "float" package.
Thus in order to get your code working, add the following to the preamble:
\usepackage{float}
I'm not sure how to tell Doxygen that this package is required so as to not have to touch the automatically generated latex files..
In fact according to the doxygen documentation here adding the following to your configuration file should do the trick:
EXTRA_PACKAGES=float
There's a discussion on the 'H' option over here and a rather detailed discussion on latex float placement in general here.
I have a git repo project in eclipse which I have been documenting using doxygen (v1.8.4).
If I run the latex make ion a fresh clone of the project it runs fine and the PDF is made.
However, if I then run a doxy build, which completes OK, then attempt to run the latex make, it fails for
! Package inputenc Error: Keyboard character used is undefined
(inputenc) in inputencoding `utf8'.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
I have tried switching the encoding of the doxyfile by setting DOXYFILE_ENCODING to ISO-8859-1 with no change in the result... How can I fix this?? Thanks.
EDIT: I have used no non-UTF-8 chars as far as I know in my files, the file referenced before the error is very short and definitely doesn't have non-UTF-8 chars in it. I've even tried clearing my latex output dir and building from scratch with no luck...
EDIT: Irealised that the doxy build only appears to run correctly. It doesnt show any errors, but it should, for example run DOT and build about 10 graphs. The console output says Running dot, but it doesn't say generating graph (n/x) like it should when it actually makes the graphs...
Short answer: So by a slow process of elimination I found that this was caused by a single apostrophe in a file that had appeared to be already built and made without error!!
Long answer: Firstly I used used the project properties to flip the encoding from the default Cp1252 to UTF-8. Then I started removing files one-by-one until rebuilding and remaking after each removal, until the make ran successfully. I re-added all files, but deleted the content in the most recently removed file and tested the make - to confirm it was this file and only this file that caused the issue. the make ran fine. So I pasted the content back into the empty file, and started deleting smaller and smaller sections of the file, again rebuilding and remaking each time until I was left with a good make without the apostrophe and a bad one with it... I simply retyped the apostrophe (as this would then force it to be a UTF-8 char) and success!! Such an annoying bug!
Dude you made it a hard way. Why not use python to do the work for you:
f = open(fn,"rb")
data = f.read()
f.close()
for i in range(len(data)):
ch = data[i]
if(ch > 0x7F): # non ASCII character
print("char: %c, idx: %d, file: %s"%(ch,i,fn))
str2 = str(data[i-30:i+30])#.decode("utf-8")
print("txt: %s" % (str2))