Unexpected token ILLEGAL in concatenated CSS file - css

I'm getting the following error in the Chrome console:
Uncaught SyntaxError: Unexpected token ILLEGAL
At the start of my concatenated CSS file:
#import url("http://fonts.googleapis.com/css?family=Raleway:300,400,600")
This line ends up on its own, and it's specifically this line that throws the error:
I've had a look around and it seems this error should relate to invisible characters making their way into the code. Unfortunately in my case that doesn't seem to be true. I've even deleted this portion of code and re-written it by hand to make sure - no difference.
I use Stylus (with gulp) and the resulting compile is naturally what throws the error - is this maybe an issue with gulp-stylus? I've looked at the compiled code and can't track down any invisible characters there either…
Does anything else throw this error?

The error implies you are trying to load the style sheet with <script> instead of <link rel=stylesheet>.
CSS is not JavaScript and can't be treated as such.

Related

How to display the error path of where the custom function is used?

If I use a built-in Sass function that returns an error, it will display the path of where it is used.
Using a built-in Sass function:
Code from _test.scss.
.foo {
color: darken(blue, s);
}
Will result in:
error _test.scss (Line 2: $amount: "s" is not a number for `darken')
Now, if I use a custom function that returns an error, it will display the path of where it is defined instead of where it is used.
Using a custom function:
Code from _test.scss.
.foo {
color: example(string);
}
Code from _functions.scss.
#function example($string) {
#error 'error message';
}
Will result in:
error core/utils/_functions.scss (Line 2: error message)
Is there any solution for solving this "issue"?
Your examples are similar only visually, underlying logic is completely different:
For built-in function Sass throws error by itself because code is not valid from Sass point of view.
Into second example you're throwing error because code is not valid from your point of view. Code itself if valid from Sass point of view in this case.
In both cases Sass displays same information about error location - a point into your codebase where error occurs. But in a case of your own, intentional error throwing actual point where error occurs actually matches a place where you're generating this error - exactly at a place where you have your #error directive. So there is no mistake into Sass behavior because it knows nothing about reasons why did you decide to throw an error.
You can always analyze stack trace that is displayed (at least by node-sass) along with error message to decide where did you get to point of error from. You can also use #debug to display context that may be useful for error analysis.

ignoring jshint Unnecessary semicolon error

I am using jshint which gives me the error "Unnecessary semicolon".
I do not control the file in question and I would like to ignore this error.
I am not able to find any such option on the jshint doc page
Turns out you can ignore any error message by setting an option for specific error numbers:
"-W032": true

SCSS precompile:assets throws invalid CSS due to http url in compiled asset file

Rails 3.1.22
sass-rails 3.2 - actionpack dependency prevents upgrading
rake assets:precompile throws error in a file called admin.css.scss
Here is the compile portion where it's complaining :
td .current{padding-right:12px;background-repeat:no-repeat;background-position:right center}
td .asc{background-image:url(http://cdn3.mysite.com/assets/up_arrow-b4361e6bd6a8af6d7d60f73acca6d973.gif)}
td .desc{background-image:url(http://cdn2.mysite.com/assets/down_arrow-d4345de2e0e231338210ca20e63f302a.gif)}
#overlay{background:url(http://cdn0.mysite.com/assets/loading-c9c18d94ad7c119962ed93ca742e78b6.gif)
I have these files in production right now, but the last time I precompiled was probably 6+ months ago - at that time I still had the CDN in effect and can't figure out what's different.
I've tried variations before coming to SO - image-url, image-path, asset-url, asset-path, tried changing scss to css.erb and using the <%= asset_path () %> helper, I keep getting this error. The actual error is :
Sass::SyntaxError: Invalid CSS after " http": expected ";", was "://cdn2.mysite..."
Does anyone have any idea how I can resolve this syntax error?
The url needs to be included in a single quote '' or double quotes ""
from: https://developer.mozilla.org/en-US/docs/Web/CSS/url
The url() functional notation The URI may be quoted by single or
double quotes. Relative URIs are allowed and are relative to the URL
of stylesheet (and not to the URL of the web page).

Fatal error: UnCSS: could not open

I'm trying to remove all of the unused css in the framework I'm using by using uncss. But when I try I get the error:
file:///C:/Users/Angus/Desktop/FTTL%20website%20submit/index.html:15 in onload
Fatal error: UnCSS: could not open C:\Users\Angus\Desktop\FTTL website%20submit\css\main.css
Does anyone know why this is?
Iyou forget to handle the first space properly (FTTL website%20submit) in the path, if you change the folder name or escape it properly (like FTTL%20website%20submit) it might work.
Edit: Or the other way around and the %20 substitution for the path was not working for the second space. (I am not familiar with uncss.)
(In my opinion it is best not using spaces in file and folder names.)

TextMate's default CSS bundle throws an error when trying to use code complete

I like code complete for CSS because sometimes I forget what values are available for a property. Unfortunately it seems that TextMate's default CSS bundle errors when trying to use it's implementation of Code Complete.
The error it generates is...
/Applications/TextMate.app/Contents/SharedSupport/Support/lib/codecompletion.rb:319:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 1: syntax error: unexpected end of filemap' for nil:NilClass (NoMethodError)
from /tmp/temp_textmate.U2Q62Q:11
...any help would be greatly appreciated.
I've Google'd everywhere and can't find an actual solution!
M.
Have you redownloaded the CSS bundle?
Did you try reinstalling Textmate (redownloading the .app and dragging it. It shouldn't remove your previous settings.)

Resources