Customized CSS codes not loading in ASP.NET MVC - css

I add a style sheet file to my project for customized style sheets. this file is in this path: ~/Content/MyStyle.css
When I run my project this file exists in the browser but there isn't any code in it.
Even I append my codes to Site.css file, those codes are wrote by mvc as default are exist, but those codes I added is not exist.
I'm confused. I wrote some code but not appear in browser.
Can you help me?
thanks

This is most likely a caching issue. You have to hard-refresh your browser. Try pressing ctrl+shift+R or ctrl+F5.
This will make sure that your modified files are requested from the server.
You can also change caching settings for your local development environment. Refer to MSDN on how to make a web.debug.config config transformation and what settings to change.

Related

Can't change the css in SuiteCRM

I am working on SuiteCRM, and i want to change the CSS of my website in order to personalize it but there is an issue.
When i am changing the "style.css" of the SuiteP Theme, the pages aren't changing at all. Here is my question:
Does someone know how to change the css of this CRM and can help me to fix it ?
Thanks a lot
Make sure that your active theme is "SuiteP".
You need to know that SuiteCRM store things inside "cache" folder and you are doing changes without refreshing cache files. Cache files location will be cache/themes/SuiteP/css/style.css. So for quick changes, you can use browser developer tools.
Moreover, if you change core style.css then empty cache directory and (hard)refresh your browser. If cache files don't exist then Suite will build new using core file.
Like Star previously mentioned, Suite does cache the CSS.
Though, if you're not updating the SASS file, and just updating the CSS directly, your changes will be temporary for when the CRM next re-builds the CSS (I believe this is part of the Repair and Rebuild process in the admin section), your changes will be lost as the CSS file constructed from the style.scss file.
I'd recommend installing sass (via a gem or other means, however you choose), making changes to the scss then recompiling the css (or watching for changes if working locally, which I hope you are for working with Suite) when you've applied your changes.
If you still don't experience changes, try a repair and re-build or delete the cache directory and let it recompile on the next page load.
there are 2 options:
change core file and then delete cache contents. Refresh your page twice.
made changes in cache file. Make sure developer mood is off. Once you are done then copy it core file.
Create a new subfolder CUSTOM, copy the CSS files that are under suiteP (or the current theme) into the new custom. copy the whole path with folders, even if the folders are empty.
So the new path for the sytle.css with be /costum/theme/....../css/sytle.css
Change the file under the custom folder. The previous answers are not correct. This is well documented under the suite CRM docs.
Sometimes it doesn't work. Try next steps:
SuiteCRM better to use in development mode.
Not always the cache files deleting works for me. Better to use the tool in Admin panel - Quick Repair.
Sometimes good to clear browser cache (in dev mode reload a page by right clicking the refresh button).

In sitecore, where can I add my own custom CSS?

Our sitecore developer quit suddenly and I need to make a small change. I'm a front end developer and have no real experience with the sitecore backend. I just need to add some CSS styles to the main style.css file or I need to add my own file. I've got full access to the CMS, but no access to the hosting account. I'm trying to find the main CSS file through the CMS browser, but I'm not having any luck.
Can you help me either:
A) Locate the main CSS file so I can add some classes (preferred)
B) Add my own link in the tag to my own CSS file hosted on another domain
C) Use the home page link to CSS file where I can add some classes
A note about OPTION C... I'm in the CMS and I see there is a system folder and in that a CSS folder where I can add a custom.css file. Then I go to the home page and I can actually call that CSS file from a field in the home page BUT, when the site loads, even though it's calling this file, it comes over as .aspx and it's blank so no styles I set are applied.
you can find the location of file as suggested by Maciej or use firebug or any other developer tools to find the location of main style.css. Once you get the location you can browser the physical file on server by going to Sitecore start menu -> All Application ->File explorer . Download file using File explorer make your changes and upload it back, make sure you check override existing file when you upload. Also make sure you upload file to delivery server once you test your changes, typically you will be accessing Sitecore using Authoring Server so instance you are accessing might not be same as CD server.
You could right-click in your browser to figure out where your css is coming from relative to the server root. Although not completely fool-proof, this method may give you a quick answer.
According to documentation for sitecore 6.2, style sheet location is determined by the developer so it could be anywhere that the developer has chosen.
Take a look at this answer for more details.
You should also be wary of how code gets built and deployed. Most Sitecore developers have very specific methodologies for how they include code (including front end) in their solutions.
Make sure you're aware of any deployment methodologies your developer used, so that your work doesn't get overwritten in a future deployment.
Did they use a source control management solution (like Git or TFS)? Did they use an automated tool to do deployments (like Octopus Deploy)?
If you can find main CSS file in physical location, you can update the file with new CSS styles.
If you want to add your own CSS as an additional CSS style, you might need to create a new template for css link and use that template when you create new page with your own CSS.
Just for future reference, by default the location of the used css files is described in Sitecore.config like this:
<!-- WEB SITE STYLESHEET
CSS file for HTML content of Sitecore database.
The file pointed to by WebStylesheet setting is automatically included in Html and Rich Text fields.
By using it, you can make the content of HTML fields look the same as the actual Web Site
-->
<setting name="WebStylesheet" value="/default.css"/>
Paths are relative to the root of your sitecore installation, you can find default.css in the root of the sitecore application on the webserver.
In Chrome Browser, Inspect element and select source tab
and open required css file and make changes.

The changes not updating on server

I have build MVC 5 application which works fine when running via VS. When I publish it to the server first time it also works. Now I have made few correction to my css file and publish whole project again but website still see the old css file. I have removed all files from the server and tried few more times but it is still the same. When I check the css file on the server, the changes are inside the file.
I think it is related to MVC bundling as when I check the source it says that is accessing different file which is not even located on the server:
<link href="/Content/cssmain?v=Ikj7NnMg3q9kTHR7ynWOJDQFGMZl3mtVMi_2EkOJxc41" rel="stylesheet"/>
How can I force VS to minificate my css file again?
I've tried cleaning, rebuilding but no luck
Edit:
My bundle set up look like below and all files are located on the server in Content folder.
bundles.Add(new StyleBundle("~/Content/cssmain").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/ilightbox.css",
"~/Content/bannerscollection_zoominout.css"));
Many thanks
I think it is related to MVC bundling as when I check the source it says that is accessing different file which is not even located on the server:
CDN location? External Css lib (yours or 3rd party)? unsure what you meant by "not located on server"?
Yup, it does (look like ASP.net Bundling in action) - check your Global.asax, App_Start/BundleConfig or _AppStart and see if the bundle configuration setup point to/reference the "correct" locations for your css (and or script).
Is it just you experiencing getting the old css file loaded? Or anyone who views the site?

external CSS sheet not loading to hosting

I'm having trouble making my CSS external stylesheet work in my actual hosting. It all works fine when I open the files from my Finder (I'm using a mac), but the stylesheet does not seem to load to my server properly. All other html files load fine and are visible when you visit my website in any browser,this is my website and the File Manager on my cPanel indicates that the CSS folder and external stylesheet file have been successfully uploaded for enough time that the style features should display. I tried clearing my browsing history and reopening my browser.
My link tag is and I have tried it using aswell as with just "css/socialpolarities.css". I've checked to make sure the spelling is right on the path and corresponds to the actual file.
Is the answer to just put all the style files in the public_html folder and then just change the path on all my html files? Or am I missing something?
I'm also using LiquidWeb if that means anything
The file css/socialpolarities.css seems to exist, but is void of content.
try looking at your local file to make sure it is indeed the one with the css code, then upload it to the same folder and override the original one.
You may have had an upload error.
I got it! The problem was actually that I needed to put the css file in the home directory, for some strange reason. My path from my html files definitely specified that the css files were in a css directory so I'm not sure if it's something I did wrong or whether the cPanel just sucks. Regardless, it works so I won't mess with it. Now time to copy all of my webfont files into my home directory...this is going to be messy lol.
Check your permission. They should be 755. You can search about permissions on internet. I changed the permissions and it worked fine.

Can I alter an aspx.vb file on the fly on a live website?

I need to know if it recompiles my site at all or if there are any issues doing this. I have tested the changes locally and in a test environment and I don't want to do a full deployment for one tiny change. I'm just not familiar with aspx.vb files and how they interact with a website.
The short answer is yes, it will cause the page to be dynamically recompiled. Dependencies could cause the entire site to be recompiled.
For more information read this MSDN article: Understanding ASP.NET Dynamic Compilation. The "Recompiling on Change" section addresses your question.
You can modify an .aspx.vb file and drop it into its respective location on the server, overwriting the existing file, and it will be dynamically compiled due to the change. However, if you were referring to having code that changed .vb file content on the fly, that sounds like a bad idea and you should reconsider your problem and approach.

Resources