LESS.js - Error msg "failed to save" - javascript

I am in the middle of a project and this morning the less JS file (I am currently using the "less.min.js" JS file for the browser (Chrome) states in the console "failed to save". This is causing my "scripts.js" file to fail when functions are in the "$(window).load()". Interesting enough, however, Bootstrap is still working, as is my LESS CSS (all my styles are on the page as it should be).
I also have Web Essestials installed, and is set to auto-compile on save (this setting was set previous to the error).
<title>#title</title>
<link href="#Fingerprint.Tag("/Content/bootstrap/bootstrap.less")" rel="stylesheet/less">
<link href="#Fingerprint.Tag("/Content/styles.less")" rel="stylesheet/less" />
<link href='//fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<script src="#Fingerprint.Tag("/Scripts/modernizr.custom.js")"></script>
<script src="#Fingerprint.Tag("/Scripts/jquery-1.9.1.min.js")"></script>
<script src="#Fingerprint.Tag("/Scripts/bootstrap.min.js")"></script>
<script src="#Fingerprint.Tag("/Scripts/less.min.js")"></script>
#*TODO: pre-compile less and remove script*#
<script src="#Fingerprint.Tag("/Scripts/json2.min.js")"></script>
<script src="#Fingerprint.Tag("/Scripts/jquery.hoverIntent.min.js")"></script>
<script src="#Fingerprint.Tag("/Scripts/scripts.js")"></script>
I have checked my security settings for IIS and they seem to be fine (once again, these are all the same settings as I was using yesterday prior to the error).
XHR finished loading: GET "http://local.lenders-one.com/Content/bootstrap/v-635549376660341373/bootstrap.less".
less.js:408
XHR finished loading: GET "http://local.lenders-one.com/Content/v-635556102777513301/styles.less".
less.js:771
failed to save - less.js:771
The "Fingerprint" class is a utility class that applies fake folders for file caching. I removed the utility class from the javascript/LESS files and I was still receiving the error.
I am using LESS v2.0.0 - any help is appreciated.

The "failed to save" is not very descriptive, but this error is send when less.js fail to write the compiled CSS code to local storage. (in your case possible because the path is not right) (see: https://github.com/less/less.js/blob/master/lib/less-browser/cache.js).
Interesting enough, however, Bootstrap is still working, as is my LESS CSS (all my styles are >on the page as it should be).
Although caching fails the compiled code will be send to the browser.
(once again, these are all the same settings as I was using yesterday prior to the error).
setting less.env to development also disable the caching and so the error.

Related

strict mime type checking is enabled, refused to execute script from '<url>' its mime type ('text/plain') is not executable, and

I am newbie in Django, and i was working on a Django app. And i used "media" folder to keep my css and javascript files (i know it's not a good practice) but it was working. Some lines of code
<link href="/media/shop/bootstrap//css/bootstrap.min.css" rel="stylesheet">
<link href="/media/shop/bootstrap//css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="/media/shop/themes/css/bootstrappage.css" rel="stylesheet" />
<script src="/media/shop/themes/js/jquery-1.7.2.min.js"></script>
<script src="/media/shop/bootstrap//js/bootstrap.min.js"></script>
<script src="/media/shop/themes/js/superfish.js"></script>
However what happened i don't know after somedays(today) when i opened this project again and tried to run on local host then i am getting error in console like this
.
After clicking on the link present in error it displays my javascript file but not executing it.
And the most weired thing is that when i executed the same file in other system(also on local host) after transferring the same folder then it is working, no any such error in console. And the same project(website) is also hosted on internet and when i open that site online in my system again then also no any such error.
However when i replace
<script src="/media/shop/themes/js/jquery-1.7.2.min.js"></script>
with
<script type="javascript" src="/media/shop/themes/js/jquery-1.7.2.min.js"></script>
then error not comes in console but it is still not working.
I don't think there is any problem with browser setting because i checked in 3 different browsers but it is showing same thing.
Any suggestion how to solve this issue and how to disable mime type checking ?
Try adding the following code to your settings.py
import mimetypes
mimetypes.add_type("text/javascript", ".js", True)
It's a solution someone told me. Sadly, it does not come with any explanation.
The script should be type="application/javascript"
Check your Windows registry key.
C:\>reg query HKCR\.js /v "Content Type"
HKEY_CLASSES_ROOT\.js
Content Type REG_SZ text/plain
Update the key as following, it works for me.
C:\>reg add HKCR\.js /v "Content Type" /t REG_SZ /d application/javascript

Does the Web App Manifest include order matter?

I am trying to add PWA functionality to a simple site, and I am running into odd issues with Chrome version 68.0.3440.106.
I am running on http://localhost:4502 for my testing, in the context of a CMS (so I am working within a few constraints). Also, note that I removed all my PWA/Service Worker code so there is no caching at play.
In the <head> .. I include the manifest via:
<link rel="manifest" href="/content/foo/bar.pwa.manifest.webmanifest" type="application/manifest+json">
(The "odd" name of the manifest file is a constraint of the CMS i'm working in; i've also used the "json" extension to the same effect as described below).
Which contains...
{"name":"Sample",
"short_name":"sample",
"theme_color":"#001F3F",
"background_color":"#FF4136",
"display":"standalone",
"scope":".",
"start_url":"/content/foo/bar.html",
"icons":[{"src":"/content/assets/sample.jpg","size":"192x192","type":"image/jpeg"},{"src":"/content/assets/sample.jpg","size":"512x512","type":"image/jpeg"},{"src":"/content/assets/sample.jpg","size":"144x144","type":"image/jpeg"}]}
I've observed the following:
When I have JS/CSS includes ABOVE my <link rel="manifest" .. things go haywire.
* If i copy the page's URL, paste it into a NEW chrome tab (a refresh of an existing tab does not cut it), and open up Chrome Dev Tools FOR that new tab, I can see the HTTP request/response for the manifest, and in Dev Tools > Application > Manifest is appears to display everything correctly. (so far so good).
* If I then REFRESH this tab, i don't see the request for the manifest and the Application > Manifest section is blank. The HTML source has not changed at all.
* No matter how many times I refresh it doesn't seem to help (also clear cache, etc.)
2) When i move the <link rel="manifest" to be ABOVE any CSS/JS in the <head> it seems to load consistently and correctly. Refreshing the page the HTTP request for the manifest displays, and Application > Manifest displays the correct info.
I've been scouring docs (Google, MDN) to see if the manifest MUST be included before ANY other includes, but I can't find anything that says that - and it's odd that on the first load of a tab, it seems to work even when included after CSS/JS.
Im hoping there is a way to get this to load regardless of where in the <head> the <link rel="manifest".. happens to be (as the CMS makes it hard to guarantee the order)
No, the relative position of the <link rel="manifest"> within your page's <head> does not make a difference from the perspective of how it's parsed and interpreted.
I'm hard pressed to explain the behavior you're seeing, other than perhaps a syntax error in the HTML that includes your JavaScript and CSS, causing the subsequent <link rel="manifest"> to be parsed incorrectly. But in general, the position shouldn't matter.

Dojo themePreviewer stuck "Loading..."

I downloaded the latest Dojo and Dijit to my local Windows 10 computer.
My disk structure is:
C:\webapps
c:\webapps\dojo
c:\webapps\demo
c:\webapps\dijit
I'm clicking on this file to load with Chrome browser:
c:\webapps\demos\themePreviewer\demo.html
It shows the following, and is stuck forever with the "Loading..." message.
Internally, I see the following references to css files:
<link rel="stylesheet" href="../../dijit/themes/claro/document.css"/>
<link rel="stylesheet" href="../../dijit/themes/claro/claro.css"/>
I can see those on my disk, here:
c:\webapps\dijit\themes\claro\document.css
c:\webapps\dijit\themes\claro\claro.css
Seems like it's a problem finding the files? But wouldn't Chrome debug tell me that? I also tried copying the dijit directory to:
c:\webapps\demo\dijit
Later I noticed there is one href in the program:
href:'../../dijit/tests/layout/getResponse.php?delay=3000&messId=3'
that I changed to:
href:'http://demos.dojotoolkit.org/dijit/tests/layout/getResponse.php?delay=3000&messId=3'
Try to run the app from a localhost instead of file:///.
In case the problem persist, you could debug it more and see if some dependencies are missing using Chrome Developer Tools > Network tab, in this way you should be able to identify any 404 errors.

Cufon Wont Load in IE11

I can't seem to figure out the reason that Cufon won't load on IE11 using Edge mode (Developer Tools). If I switch over to IE10 mode the site loads perfectly fine - however with Edge mode on IE11 Cufon refuses to load up.
Any ideas with this?
http://rapidpurple.com
I had this issue myself, and also had trouble finding an answer online, so I thought this must be a really specific issue. I've opened the IE dev tools, checked the console, and there was this curious error:
SEC7113: CSS was ignored due to mime type mismatch
File: ligthbox.css
The error is not correctly reported, as the css file is served with correct mime type, but the thing was actually that it failed to get the file due to the page being rewritten with htaccess into /some-directory/ and the lightbox.css file was included without the leading slash, like this:
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
After I added the leading slash, the error was gone from the console, and the Cufon loaded correctly.

Error in console: uncaught error history.js adapter has already been loaded

I'm creating an small module for activeCollab composed by some webpages. I'm using PHP and Javascript/jQuery/AJAX. When I enter into the main page of the module I'm creating everything is working fine, but if later I try to go to other modules my web application is crashing. Is not showing any information. The only way for reviving it is refreshing the navigator.
If I check the error console of my navigator, I see that when I'm exiting from my custom webpage it says
`Uncaught Error: History.js Adapter has already been loaded...`
The header of my HTML file has this information:
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
And this code is making my Javascript functions work properly.
What can be happening? I googled and I didn't found much information about this issue. Every help would be appreciated.
Finally I solved it, the problem was that my application is loading by default its own jQuery file and there was a conflict between this one and the ones I was trying to import. The solution was easy: I only had to delete the lines I wrote inside the "head" tag.
Thanks for your help!

Categories

Resources