While trying to use grunt to convert my sass files into normal css files i get the warning:
Warning: Encoding::CompabilityError: incompatible character encodings: UTF-8 and CP850.
However when I run sass calling the file(s) everything works as it should even though no encoding is specified by me. My Gruntfile.js looks like this:
[...]
sass: {
main: {
files: {
'css/theme/default.css': 'css/theme/source/default.scss',
'css/theme/beige.css': 'css/theme/source/beige.scss',
'css/theme/night.css': 'css/theme/source/night.scss',
'css/theme/serif.css': 'css/theme/source/serif.scss',
'css/theme/simple.css': 'css/theme/source/simple.scss',
'css/theme/sky.css': 'css/theme/source/sky.scss',
'css/theme/moon.css': 'css/theme/source/moon.scss',
'css/theme/solarized.css': 'css/theme/source/solarized.scss',
}
}
}
[...]
which is a part of the Gruntfile.js I forked from the reveal.js on GitHub. I took a look at the grunt-contrib-sass on GitHub and tried to find the option to change the encoding manualy. However it apears that there is none (maybe I just overlooked it?).
I think a keypart of the problem is that I am using Windows 8 and not any Unix based OS.
So my question is:
How do i get rid of this warning? Or how do i fix the code to work properly?
Any help is appreciated.
I had this error when trying to use the command:
sass --watch global.scss:global.css --style compressed
And the cause was the most stupid cause ever... I had this folder: E:\Dropbox[Websites][External] Fundación Global\css and I run the command in there, and SASS returned this same error: Warning: Encoding::CompabilityError: incompatible character encodings: UTF-8 and CP850.
I just needed to take out the ó from the folder's path!
That simple and silly! Just changed this: ...Fundación Global\css for this ...Fundacion Global\css and I have SASS watching with no issues again.
Related
I am trying to build a website using blogdown, and the Hugo theme Sam.
This theme has SASS files that get converted into a minified css file.
When I change something in the SASS file, like for example the background color, it is not taken into account when using serve_site.
Is there a way to make this work using blogdown?
A way to reproduce the issue is:
Create an empty directory called for ex. test_sam, and set it as a working directory
then do:
library(blogdown)
new_site(theme = "victoriadrake/hugo-theme-sam")
Try to change something in test_sam/themes/hugo-theme-sam/assets/sass/style.sass, for example:
change
html
background-color: $dark-grey
to
html
background-color: $white
This doesn't produce any change.
Color variables (such as $white) are defined in test_sam/themes/hugo-theme-sam/assets/sass/_vars.sass
The odd thing is that if I change it to an undefined variable name like $yellow, I get the following error message:
Building sites … ERROR 2019/12/27 20:44:39 Transformation failed: SCSS
processing failed: file "stdin", line 11, col 23: Undefined variable:
"$yellow". Total in 197 ms Error: Error building site: logged 1
error(s)
which shows that blogdown does access the sass files to build the site.
I have very little knowledge about website building nor css, so maybe there is something quite obvious that I'm not getting.
Thanks for your help!
Although late to answer, I solved this issue with the same theme by setting the "blogdown.generator.server" option to TRUE.
options("blogdown.generator.server" = TRUE)
blogdown::serve_site()
Update: This actually seems to be a common issue with the Sam theme specifically. The theme uses some tools not included with Hugo, and you have to download them separately. It's addressed in the README.
Open Terminal and run:
npm install -g postcss-cli
npm install -g autoprefixer
After that, blogdown::serve_site() worked normally for me. It also fixed some plot rendering issues I was having.
Currently, I've got Prettier set up through ESLint using the following .eslintrc.json:
{
"extends": ["react-app", "plugin:prettier/recommended"]
}
This works fine for linting and formatting JavaScript files.
However, when I'm trying to run ESLint (and thus Prettier) on Markdown and CSS files, errors like the following occur:
/Users/willem-aart/Code/foo/bar.md
1:1 error Parsing error: Unexpected character '#'
> 1 | ## foobar
| ^
✖ 1 problem (1 error, 0 warnings)
It seems that ESLint cannot handle the file. On the other hand, Prettier – when run standalone – handles the file as expected.
Is it possible to format files other than JavaScript using Prettier through ESLint? Or am I better off using Prettier standalone?
I guess Prettier can be applied to a broader range of file formats than ESLint is intended for.
We are experiencing a bizarre random behavior of the LESS compiler at the Windows Command Line. We are getting inconsistent syntax error messages like we were missing variables or mixins declarations. The thing is, if we LESS compile the same file a second time, the compiler works just fine and we get our beautiful CSS file. The same files work just fine using the client side less.js while running our solution in Visual Studio.
Some more details:
LESS compiler (less#1.4.0-b4) at the Windows7 Command Line.
Here is what I type on command line:
lessc --include-path="site/Css" Css\results-imports.less > fileoutput.comb.css --yui-compress
results-imports.less has a list of less files that should be imported and compiled into css files, some of the less files have nested imports as well.
we get errors like: NameError: variable #brand-color-14 is undefined in C:\Css\loadmask.less. This is one of the imported less files #brand-color-14 is declared in one of the less files that should have been imported before loadmask.less
I am currently using Sublime Text with LESS.build package to compile my .less files into CSS.
My current LESS.build cmd is:
"cmd": ["lessc", "screen.less", "${file_path}/screen.css", "--verbose"]
I tried to add some extra folders to the --include-path:
"cmd": [
"lessc",
"screen.less",
"${file_path}/screen.css",
"--verbose",
"--include-path='.:/var/www/whatever/'"
]
But, whenever i try to build my .less files the --include-path params seems to be ignored.
The only workaround i found is adding the full relative path on my #import:
#import "../../../www/whatver/config.less"; //Ugly solution
Can anyone point me where i am failing and/or any other workaround prettier than mine's?
Looks like there was a bug out for this. https://github.com/cowboyd/less.rb/issues/13
and there was a similar issue here LESS #import: Passing paths to lessc.
I love TextMate as my editor for all things web, and so I'd like to use a snippet to use it with style.less files to automatically take advantage of the .less way of compiling .css files on the fly using the native
$ lessc {filepath} --watch
as suggested in the less documentation (link)
My (thanks to someone who wrote the LESS TM Bundle!) current TextMate snippet works well for writing the currently opened .less file to the .css file but I'd like to take advantage of the --watch parameter so that every change to the .less file gets automatically compiled into the .css file.
This works well when using the Terminal command line for it, so I am sure it must be possible to use it in an adapted version of the current LESS Command for TextMate since that only invokes the command to compile the file.
So how do I add the --watch flag to this command:?
#!/usr/bin/env ruby
file = STDIN.read[/lessc: ([^*]+\.less)/, 1] || ENV["TM_FILEPATH"]
system("lessc \"#{file}\"")
I assume it should be something like:
#!/usr/bin/env ruby
file = STDIN.read[/lessc: ([^*]+\.less)/, 1] || ENV["TM_FILEPATH"]
system("lessc \"#{file}\" --watch")
But doing so only crashes the TextMate.app.
Did you try running it as a background task?
system("lessc \"#{file}\" --watch &")
I'm guessing you have to put the --watch parameter before the file parameter to lessc, like so:
system("lessc --watch \"#{file}\"")
Take a look at this snippet. It doesn't use the --watch flag, but if you link it to the cmd+s key combination it works perfectly. The snippet will also compile any less files that reference (i.e. #import) the file that was changed. This is great if you have a until.less or something that you include in many different less files, if you change the util.less all the LESS files that depend on it will auto-compile.
Combine that script with the browser refresh script and you have a fairly decent web dev testing routine.