Unexpected token '.' when bundling stylesheets with MVC 4 - asp.net-mvc-4

BundleConfig.cs
bundles.Add(new StyleBundle("~/Content/styles").Include(
"~/Content/css/test.css"
)
);
_Layout.cshtml
#Scripts.Render("~/Content/styles")
Test.css
body{
font-size: 75%;
color: #232323;
text-align: left;
margin: 0px;
padding: 0px;}
This is what Chrome shows as being loaded giving me a Syntax Error about an unexpected token { :
body{font-size:75%;color:#232323;text-align:left;margin:0;padding:0}

I would've selected Abi's answer for the link he provided, but it was a comment rather than an answer. So, I'm posting this as the answer to ensure this question is marked as resolved.
Basically, the link Abi provided stated that the reason for the error is that the browser was trying to load css as though it was javascript.
I realized right away that I was using #Scripts.Render() and should've been using #Styles.Render() instead.

Related

PhantomJS not rendering screenshots with webfonts?

So I have been looking around and can't seem to find a solution on how to get PhantomJS to actually display webfonts on screenshots, can anyone tell me if there is a way to do this?
I have been testing and testing for about a week now and finally came up with the answer, know that this might also be a result of me running PhantomJS on a Windows machine. I am currently running PhantomJS v1.9.7 and have found the following solution:
Using this in my CSS file:
#font-face {
font-family: 'Vampiro One';
src: url(http://themes.googleusercontent.com/static/fonts/vampiroone/v3/Ho2Xld8UbQyBA8XLxF1_NYbN6UDyHWBl620a-IRfuBk.woff) format('woff');
}
.vamp {
font-family: "Vampiro One";
font-size: 1.5em;
}
Instead of the Google recommended "failsafe":
#font-face {
font-family: 'Vampiro One';
font-style: normal;
font-weight: 400;
src: local('Vampiro One'), local('VampiroOne-Regular'), url(http://themes.googleusercontent.com/static/fonts/vampiroone/v3/Ho2Xld8UbQyBA8XLxF1_NYbN6UDyHWBl620a-IRfuBk.woff) format('woff');
}
.vamp {
font-family: 'Vampiro One', cursive;
font-size: 1.5em;
}
seems to do the trick. I hope this saves someone from being as frustrated as I have been.
To those who have a hard time spotting the difference, I removed the "local()" fonts to it only point to the one font I really want, as well as removing fallback fonts, I am thinking this has to do with some false positive in either PhantomJS or the WebKit engine.

Looking for a web service allows you to upload via their API and then replies with the file URL [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
The title says it all. I'm looking for a web service that allows you to upload via their API and then replies with the file URL. Is this something that exist?
Well, this is not exactly what you said (A web service: Like a service that some company provides instead of being a software you can install on your machine)
If being provided by someone else is not a strict requirement, and a code that you can install on a server of yours works ok for you, as long is very turn-key, well, I have coded something like that for uploading images: https://github.com/chris-l/urImgAPI
It uses a RESTful API, and is coded on PHP (so it can be used on any cheap host).
I created this API for uploading images, but it can easily be changed to upload any kind of file. (is just removing the gd image manipulation stuff)
The API has a security feature to prevent that a random person could save things on your server, by requiring a signature. The signature works like this: (this example line is on php)
$signature = md5(md5sum(your_image_file) . "your secret key");
You never transmit the secret key plain, only the generated signature.
Is very easy to use IMHO. I use it like this on my terminal:
On my .zshrc file, I have this function: (But you can turn this to an bash script, or whatever, if you want)
uploadpic() {
signature=`echo -n "$(md5sum $1|awk '{print $1}')"my_secret_key|md5sum|awk '{print $1}'`
curl http://my-fileserver.com/upload.php -F image=#$1 -F signature=$signature -F user=user -F filename=$1
}
With that on its place, I'm able to upload an image by just doing:
$ uploadpic someimage.jpg
Then I get an XML answer, that is like this:
<response success="true" url="http://my-fileserver.com/view.php?file=user/pBfeP&filename=someimage.jpg" md5="52c5e7013c61cbb8c74ddc390d83a0b5" filename="someimage.jpg" thumb="http://my-fileserver.com/view.php?file=user/pBfeP-thumb&filename=thumb-someimage.jpg"/>
The url attribute is the file URL you wanted.
If it had to be a service provided by some company, I guess this is not what you want, but hey, cheap php hosting is really cheap, and this way you can be certain that they wont delete your images, and keep a backup of everything, etc.
Is released under the AGPL3 license, so check it and I hope it could be useful for you.
A little late, but maybe it is of use to someone else.
This simple code uploads images to Imgur with an anonymous api key. (create your own key if you decide on using it)
Copy/paste the link when it is uploaded if you can't see the image.
<br><br>
<div>DROP!<button onclick="document.querySelector('input').click()">Or click</button></div>
<input style="visibility: collapse; width: 0px;" type="file" onchange="upload(this.files[0])">
<p>Uploading...</p>
<a id="link">It's online!!!</a>
<style>
body {text-align: center; padding-top: 100px;}
div { border: 10px solid black; text-align: center; line-height: 100px; width: 200px; margin: auto; font-size: 40px; display: inline-block;}
#link, p , div {display: none}
div {display: inline-block;}
.uploading div {display: none}
.uploaded div {display: none}
.uploading p {display: inline}
.uploaded #link {display: inline}
em {position: absolute; bottom: 0; right: 0}
</style>
<script>
/* Drag'n drop stuff */
window.ondragover = function(e) {e.preventDefault()}
window.ondrop = function(e) {e.preventDefault(); upload(e.dataTransfer.files[0]); }
function upload(file) {
if (!file || !file.type.match(/image.*/)) return;
document.body.className = "uploading";
var fd = new FormData();
fd.append("image", file);
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://api.imgur.com/3/image.json");
xhr.onload = function() {
document.querySelector("#link").href = JSON.parse(xhr.responseText).data.link;
document.body.className = "uploaded";
}
xhr.setRequestHeader('Authorization', 'Client-ID 14a7704c52e4b75'); /* Please make a new key if you decide on using this */
xhr.send(fd);
}
</script>
http://codepen.io/drduval/pen/jqeygE

why display css code in the content in Safari of question2answer system?

I installed question2answer on my mac and i login by Safari and ask a question, after posted the question, i view the question, there is a strange line in the content:
next_pages_container { width: 5px; hight: 5px; position: absolute; top: -100px; left: -100px; z-index: 2147483647 !important; } test question
but it works fine if i use Chrome.
I think this code line is a css code, i don't know why it's display in the content.
Anybody can help me? thanks.
Apparently, it is a bug in "Evernote Web Clipper" for Safari:
http://discussion.evernote.com/topic/26375-help-clipper-injects-clearly-html-into-my-pages/
The clipper inserts the code in all editable areas. The suggested workaround is to disable the clipper.

SASS box-shadow Mixin crashing Internet Explorer 8

I'm using SASS with Rails 3.2.3 and Ruby 1.9.3 in RVM.
My issue is that, for one reason or another, my SASS box-shadow mixin causes Internet Explorer 8 to crash on page load, no error from IE, just completely closes. If I remove the mixin, it opens perfectly...The mixin looks like:
#mixin boxShadow($params) {
-moz-box-shadow: $params;
-webkit-box-shadow: $params;
box-shadow: $params;
}
I have this at the top of my application.scss
#import 'mixins';
I'm using the mixin as such:
#include boxShadow(0px 1px 3px #999);
Any idea why this could be happening?
Turned out to be an old version of respond.min.js blowing things up!

How to change css styles of Google Plus Pages Badge?

I configuring standart badge on https://developers.google.com/+/plugins/badge/config
For it Google+ rendering iframe content.
How i can change classes styles inside iframe?
At this time it seems there is currently no way to do it. I tried editing the CSS to get rid of the annoying border and white background:
.yeb {
background-color: none !important;
border: 0px solid gainsboro !important;
}
But since the CSS is in the Google server you can't override the iFrame. It is a current feature request in the Google forums.
You can do a little trick:
The HTML for the iframe:
<div id="social_gplus_circle">
<div id="social_gplus_circle_inner"><g:plus href="https://plus.google.com/105379671042990608528" size="smallbadge"></g:plus></div>
</div>
The CSS for the trick:
#social_gplus_circle{overflow: hidden;width: 105px;height: 45px;padding-top: 7px;}
#social_gplus_circle_inner{overflow: hidden;position: relative;top: -20px;left: -130px;height: 50px;width: 276px;}
iframe{display: block!important;}
I did not made this myself, I got it from a google forum.
You can't change it , because the google plus code is not on your server.
You can only modify the iframe CSS , if your page and the iframe code is on the same server.