PostCSS won't complie SCSS due to indentation? - css

First time using this set up, but I can't seem to figured out why the .scss file won't compile after I add any styles.
I added
.test { color: #fff; }
And you can see in cmd line that it's not compiling, but I can't seem to figure out what it wants me to do.
ERROR in src/stylesheets/styles.scss
3:5 ✖ Expected indentation of
2 spaces indentation
4:1 ✖
Unexpected missing end-of-source newline
no-missing-end-of-source-newline
cmd line screenshot

It appears to be asking for a 2 space indentation, you have either 4 spaces or a tab, so change that to 2 spaces and it also seems to be asking for a line feed at the end and you have none, so just add one of those and try again.

It just needed one more extra line to be left as seen below

Related

Code not indenting properly. Is there a solution?

It seems that the python code in R reticulate is not indenting automatically. E.g. when I write
if x < 0:
print("negative")
else:
print("positive")
the third line should move automatically at the same level of if but, it actually does not and I get the message IndentationError: unexpected indent (<string>, line 1)
Is this bug or can it be corrected?
This can be solved by correcting the indentation of you code, following Python rules :
You need to unindent the else so it's indentation match the if ones. Rstudio don't indent correctly for Python to this day.
if x < 0:
print("negative")
else:
print("positive")

SCSS compiler not working properly in PyCharm

I am trying to set up a SCSS transpiler in PyCharm for Django project.
Basically, what I need is to convert /static/scss/main.scss to /static/css/main.css
Here are the configurations of SCSS File Watcher:
Program: /home/maverick/.rvm/gems/ruby-2.2.3/bin/scss
Arguments: --no-cache --update /home/maverick/Documents/DjangoProjects/timberg/static/css/$FileNameWithoutExtension$.css
Working directory: /home/maverick/Documents/DjangoProjects/timberg/static/scss
Output paths to refresh: /home/maverick/Documents/DjangoProjects/timberg/static/css/$FileNameWithoutExtension$.css
What is happening is that main.css is being generated where it should. But it contains only errors, not the expected css, like this:
/*
Error: Inconsistent indentation: 2 spaces were used for indentation, but the rest of the document was indented using 8 spaces.
on line 39 of /home/maverick/Documents/DjangoProjects/timberg/static/css/main.css
and etc.
What is wrong here? How can I fix it?
The problem was in the Arguments part.
It should be:
$FileName$:/home/maverick/Documents/DjangoProjects/timberg/static/css/$FileNameWithoutExtension$.css
not just:
/home/maverick/Documents/DjangoProjects/timberg/static/css/$FileNameWithoutExtension$.css
My mistake was leaving out $FileName$: at the beginning.

Emacs ESS Mode TAB stops indenting

I'm using Emacs 24 on Windows to write some R code. Up until about 30 minutes ago, whenever I would write a new function, ESS would automatically indent the lines following the function declaration and pressing the tab key on a new blank line would jump me to the appropriately indented starting position inside the declaration.
EG:
foo <- function() {
first line started here
second line here. .etc
}
Now, it is hard wrapping everything to the left, and not responding by automatically indenting after the function declaration or when I hit the tab key.
foo <- function() {
first line
second line
}
I've googled, but my google-fu is failing me on this. Anyone know how to restore default tab behavior to ESS in Emacs?
just for the record. Whenever such things happens, select the whole buffer C-x h and press C-M-\ to indent the whole region. This will show unambiguously the syntax error.
Try to add a space after "#".
I don't think ESS-mode handles # as a comment unless you have space after it.
I just came across the same problem you describe.
None of the above seemed to work, but I narrowed it down to using a carriage return and then an open parenthesis inside a string, like so:
### indent ( <tab> ) working fine up to here
s1 <- "string
(then this in brackets)"
### now indent does nothing!
The fact that it's balanced later doesn't help. I think EMACS reads this as opening a new expression/ block in spite of the fact that it occurs in a quoted string. This seems to apply also to expression openers { and [. It only seems to happen when the 'open expression' symbol appears at the start of the line...
In my case the string was part of a plot label, so the solution was to use \n instead.

How do I edit the VIM Omni Completion so that all CSS properties do not end in a colon?

I have been exploring some way in VIM to automatically append closing characters to a line of code. In my case it is CSS. I came across this tip http://vim.wikia.com/wiki/Automatically_append_closing_characters and tweaked the code it tells me to add to my .vimrc like so
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {{ {
inoremap {} {}
so when I write
body
and then press { and ENTER in rapid succession what results is
body {
}
Note that the cursor will be indented and on the 2nd line so I will be ready to write code in that block.
Also I should mention that I also added the following to my .vimrc
inoremap :: :;<Left>
so that when I type : and : in rapid succession I will get :; with the cursor located in between the : and ;. This exactly where I want to be so I can start writing code right away.
I got that working fine but I quickly realized that the auto complete plug in that I installed (AutoComplPop VIM plug-in http://www.vim.org/scripts/script.php?script_id=1879) conflicts with the above .vimrc tweak.
So for example, if I start to write color I get the drop auto completion drop down menu of all options. The problem is that the option for color is actually color:.
You see it has a colon already added to it so when I select it, the colon is already there and then I have to manually add the closing ; character. This basically defeats the whole purpose of adding the auto appending closing character code to my .vimrc since in this case, it does not auto append the closing semicolon.
So how do I make a custom edit to VIM's Omni Completion so that all CSS properties do not end in a colon?
CSS auto completion options for VIM and came across AutoComplPop here http://www.vim.org/scripts/script.php?script_id=1879
Assuming you are on a UNIX-like system…
Copy
/usr/share/vim/vim7x/autoload/csscomplete.vim
to
~/.vim/autoload/csscomplete.vim
Find the loop that generates the list of properties, for me it's at line 92.
Remove the colon from the second parameter of the two add().
These lines:
call add(res, m . ':')
call add(res2, m . ':')
become:
call add(res, m)
call add(res2, m)
Save the file.
Also there are many plugins for "auto closing" pairs of characters. I use DelimitMate.
And the issue is not related to ACP at all.

finding vim efm for csslint messages

With the newly released csslint I wanted to try to hook it into vim as my makefile for .css files. I'm having a hard time getting the multi-line error format working for the output.
My best result so far is:
au BufRead *.css set makeprg=csslint\ %
au BufRead *.css set errorformat=%A%f:,%C%n:\ warning\ at\ line\ %l\,\ col\ %c,%C%m,%C%.%#,%C%.%#
That doesn't get the line/column numbers right though. I'm getting this output in my quickfix window:
|| csslint: There are 33 errors and warnings in bookie.css.
||
bookie.css|| 1: warning Too many font-size declarations (13), abstraction needed.
bookie.css|| 2: warning at line 3, col 3 Rule is empty. BODY {
bookie.css|| 3: warning at line 12, col 12 Values of 0 shouldn't have units specified. padding: .5em 0em;
bookie.css|| 4: warning at line 13, col 13 Values of 0 shouldn't have units specified. margin: 0em;
...
The format from csslint is:
csslint: There are 33 errors and warnings in bookie.css.
bookie.css:
1: warning
Too many font-size declarations (13), abstraction needed.
bookie.css:
2: warning at line 3, col 3
Rule is empty.
BODY {
Anyone see what's wrong with my efm? Or have something that might work? I'm trying not to go the route of writing another parse script to clean up the format. Thanks for the help.
You need to use a double backslash to escape commas in Vim's errorformat.
I just commited a CSS syntax-checker to Syntastic plugin, using CSS Lint. Just fetch the latest Syntastic version from GitHub, and install CSS Lint CLI tool, and you'll be on your way.
Please note that CSS Lint's warning/error format is pretty incosistent, but the plugin I wrote handles it pretty well. I expect it to improve in the future.
Working with vim's errorformat is a veritable nightmare. Usually I re-write lint output in shell for vim, though with the --format=compact switch it's thankfully workable.
set makeprg=csslint\ --format=compact\ %
set errorformat=%f:\ line\ %l\\,\ col\ \%c\\,\ %m
Source: https://github.com/kaihendry/vim-html5/blob/master/ftplugin/css.vim

Resources