Drupal CSS and JS - javascript

I'm working on a project where I made a copy of a live site on to my localhost to work on. I've made updates to a sub theme css/js, added the new CSS file to the sub theme .info file, and modified the preprocess_page and added the JS with the drupal_add_js method.
All this seems to work very well on my localhost, but pushing live, the site still picks up the old CSS/JS files.
I cleared all caches I could find:
Site Configuration/Advanced CSS/JS Aggregation/Smart cache flush
Site Configuration/Advanced CSS/JS Aggregation/Cache Rebuild
Site Configuration/Performance/Clear cached data
but I'm still getting the same result. The old CSS/JS files persist. Where am I going wrong?

Yes, Drupal sometimes jamming, despite cleaning the caches...
I was then helped by deleting files from these folders:
./sites/default/files/css
./sites/default/files/js
Note: If you want this, instead of deleting it, you can move it to another folder.

Related

Spring Boot 2: some static resources are not loaded

I added static resources into /static/ path in spring boot application.
/static/
/css/
/images/
/js/
When page loaded some css and js files are not loaded. For example: /static/js/jquery-ui/css/no-theme/jquery-ui-1.10.3.custom.min.css loaded, but, /static/js/jquery-ui/js/jquery-ui-1.10.3.minimal.min.js and /static/css/font-icons/entypo/css/entypo.css resources are not loaded - returned 404. If I move these resources to 1 or 2 step upward in folder tree, theese resources get reachable, so I can download them with direct url. but I don't want to do this. Because they are part of some template and moving can damage theme structure.
I copied not loaded files to same folder with different name.
/static/css/font-icons/entypo/css/
entypo.css
entypo_1.css
After, deleted old version and renamed new copy as old version. I don't know why, but after doing this operation for all not loaded resources they are loaded. Now its work for me.
EDITED
It need to be cleaned and built project in such situations.
This problem occurred again when I run project without building after checking out project to another PC from SVN. Then I cleaned and built project and run. The problem did not occur after that

Trying to deploy a GitHub page but having trouble with CSS and JS not showing up?

I have easily deployed the files, but all I get is the plain HTML - none of the CSS or JS is transferring over. The GH page is mcdanielj8.github.com/todolist
I've even tried changing the path to todolist/assets/css/...., but that hasn't worked either.
I wish I could just upload a static site to Heroku!
Got it - the path is case sensitive, apparently. Assets/css/main.css , etc worked.

How to not tell browser not to save cache

I have a laravel 5.2 app. My problem comes every time I update my website, I have all my clients calling me because something is not working, and the problem is because some .js and .css are in the cache, and I have to explain them how to erase the cache.
What's the best solution?, How is the tag to tell the browsers to not cache my .js or .css (or some of them, specified)?.
Thank you
You can version your JS and CSS when including them in your HTML by adding a version to the tag, such as <link rel="stylesheet" href="style.css?v=3.4.1">
When you make a change to the CSS or JS, change the version, and anyone visiting the page will load the new version instead of relying on the browser cache.
If you are using elixir with Laravel there are options included for versioning and cache-busting https://laravel.com/docs/5.3/elixir#versioning-and-cache-busting
The way of making the browser will not save cache is by creating a new version for the source each time any user get to the web page.
The cache-buster query string can be updated so that the
browser doesn’t recognise the file in it’s cache and downloads a new
version.
I found a great information in the cache boosting link.
If you are using apache that link may be also very helpful.
In laravel there's a versioning for stylesheets and scripts. Use laravel-elixir can be found here.
If version only css stylesheet then you can use like:
elixir(function(mix) {
mix.version('css/all.css');
});
and you will have something like this all-16d570a7.css
If you want multiple files like css and js:
elixir(function(mix) {
mix.version(['css/all.css', 'js/app.js']);
});
And finally to run this versions you can simply enter the command below in your console:
gulp or to be more specific gulp version.
Hope this could help.

Scroll function disabled locally, still working on live site

Hi all I have to make updates to a site one of my predecessors created years ago. The smooth scroll has failed to load its resources thankfully the live site is still functioning as it should http://www.asla.org/greenroof/index.html
I also just want to add that the local files threw no errors about a month ago when I last checked locally.
I will need to upload the index.html file along with new images to make the updates. I assume this will not change or disable the functionality of the live site.
Currently just trying to get the scroll to work locally. This cursor .cur element I cant find anywhere so I assume its part of a jquery library.
Any ideas? Thanks again.
Here are the errors I'm getting I have no idea how to fix this. Help would be appreciated.
console
index.html
jqueryLoader.js line 23 and 109
jquery.tools.min.js line 174
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
Here is also the CSS
Server doesnt even have /cursor directory from path specified by console
Update 3/25/15
Local site scroll works fine returning no errors when set up on local web server MAMP. Quite strange how accessing the site via file:// stopped working randomly.
If you just want to do a local test you can go through the css and rename
background-image: url (../images/cursor/rightArrowoutline.png);
background-image: url (../images/cursor/curspr_arrow_right.cur)
background-image: url (../images/cursor/curspr_arrow_left.cur)
to
background-image: url ('http://www.example.com/greenroof/images/cursor/curspr_arrow_right.cur')
background-image: url ('http://www.example.com/greenroof/images/cursor/curspr_arrow_left.cur')
example.com would be the name of the live domain.
If you want a production ready file when you are done, I would set up a local web server. Check out all of your source files and make a local version of the site.
MAMP is a pretty fast setup.
http://en.wikipedia.org/wiki/MAMP
Update: 3/10
It looks like the cursors are in two places on your servers files system.
Do you have both directories with the files?

changes to javascript file "ignored" in VS2010

I have a javascript file harSympCode.js that I am trying to make changes to. It is used in 5 aspx pages - .NET 4.0 & VS2010 - and needs to remain consistent for all 5.
In the js file there is a function startstop() which triggers a floating clock to count. It is called in the onload event of the body tag. It works just fine. There is another function (call it function1()) which is supposed to load some values to a form. It is almost identical to a second one (call it function2()) in the file except the second one does a form.submit() when it is done. I am attempting to modify function1() to also submit the form when done BUT no matter what I do, I can not get the system (VS2010 localhost) to recognize the 2 lines of code I added. Since they are working just fine in function2() and I don't see any error codes or warnings when I rebuild the website, I can only guess that the changes are being ignored.
What I have tried:
Removed the <script> tag from the aspx pages: Result - startstop(), function1() and function2() are not found.
Added the <script> tag back in but removed the script file from the solution/project directory structure: Result - everything runs as if the file was still there.
Deleted sln and suo files and reopened the website while at the same time trying options 1 and 2: Results - same as 1 and 2.
I have looked through my entire directory structure and renamed and/or deleted every version of the js file I could find, to no avail.
I have looked for anything and everything related to precompiling a website (NOT application) and attempted to make changes to a supposed "Precompile" directory but a) could not find the directory and b) all changes I made were ignored and/or reset the next time I went and looked.
Has Anybody seen this and how did you fix it?
This does not seem like an IDE issue as mentioned in your comment. Make sure you set your browser to refresh the cache on each load. In IE:
If you're using Chrome, then cache is cleared from the dev tools and is very persistent. Also refresh the page using CTRL+F5. You also want to make sure that you're not getting compilation errors and your project isn't running from the previous working version. However point 1 of what you've tried suggests that the generated HTML page refreshes when you run your project but your browser cache contains the javascript files and so when the script tag exists it finds the cached ones and executes them. So you can use the 2nd button from the top (Clear Browser Cache...) to remove them.
I had been having this issue, clearing my cache and wondering why VS2010 kept looking at the old file, even though it appeared as the new version in F12.
The solution turned out to be that TFS had the file locked, and that once I checked out the javascript in question, the debugger picked up the new version.

Categories

Resources