Chrome dev tools CSS source mapping doesn't work by default - css

Myself and my other developers are seeing an issue with Chrome dev tools not recognizing our CSS source maps immediately. Our minified CSS file and .map file are definitely being served and available to the dev tools, but we have to open Settings > Sources > Uncheck and Recheck "Enabled CSS source maps" to get the inspector to reference the actual _partial.scss files for styles. If we don't uncheck and recheck the source maps toggle, it just shows a direct line reference to the minified CSS file, which is not useful.
Has anyone encountered this issue before or know a better workaround for it? This is happening on the latest Chrome version and with several before it.

Related

How to solve CSS intellisense for VSCode not working?

Well, this is embarrassing, basically, the CSS Intellisense stopped working out of the blank, not sure if I can relate it with the installation of TailWind Intelissense extension, interestingly it works on SCSS files, but if I try it in a vanilla HTML + CSS project it does not work. I am using Fedora 35. I already tried restarting the editor as recommended on the official website.
I had the same issue. So, I solved it by adding
"files.associations": {
"*.css": "css",
"css": "css"
}
to my my settings.json file. Don't know is it is going to help you, but anyway. Good luck!
I know this is a little late for the answer, but I had the same issue when using tailwind.
Given that you are using tailwind, most likely there is a chance you are using postcss, which you can confirm by checking postcss.config file.
If that is the case, then install the postcss vscode extension, and follow the instructions:
Open the command palette and select Preferences: Open Settings (JSON)
Add the following configuration:
{
"emmet.includeLanguages": {
"postcss": "css"
}
}
This should fix your css autocomplete, it is what worked for me.
When I'm using a basic style.css file, even after adding "postcss": "css" in "emmet.includeLanguages":{} CSS Intellisense still doesn't work.
Disabling the postcss VSCode extension allows CSS Intellisense to work properly for me.
if you install extension POSTcss try to disable
Another late answer but it seems this is still an issue when using the extension PostCSS Language Support.
Solved by uninstalling that extension and replacing with PostCSS Intellisense and Highlighting.
Here's what the official website says if IntelliSense isn't working:
Troubleshooting #
If you find IntelliSense has stopped working, the language service may not be running. Try restarting VS Code and this should solve the issue. If you are still missing IntelliSense features after installing a language extension, open an issue in the repository of the language extension.
…
A particular language extension may not support all the VS Code IntelliSense features. Review the extension's README to find out what is supported. If you think there are issues with a language extension, you can usually find the issue repository for an extension through the VS Code Marketplace. Navigate to the extension's Details page and select the Support link.
You should probably try:
Disabling any extensions that may be related to the issue. You mention that it may have to do with the TailWind Extension; try disabling or uninstalling that and see if the intellisense starts up again.
Restarting the editor again.
Filing an issue on their GitHub page if it's still not working.
I came to this question having a similar issue and found I just needed to manually change the language mode in the bottom right to CSS rather than Post-CSS. Obvious in hindsight, but just recording here in case anyone hasn't tried it.
I have installed this extension in vs code. CSS, HTML and Bootstrap intelligence showing up.
IntelliSense for CSS class names in HTML
Follow these steps:
Click on Select Language Mode option in the Status Bar of VSCode
Click on Configure File associations for .css in the modal opened
Configure the language you want to associate your *.css files to. Here in our case, you need to select CSS
Reload VSCode window if changes don't get reflected

Realtime css/less/scss edition using chrome DevTools in meteor

I want to raise this question again.
What was suggested in the answer to this question is to use old fashioned approach:
Store css in public folder, and incude it via <link href=
Add public folder to google chrome devtools workspace
Not a rocket science at all. Works, but two things I don't like with this approach:
It's still not native and for production I will have to move files from public folder
Each time you edit css, meteor notices changes and reloads application. Author of that answer ignored it.
Basically this result I want:
I start meteor project, open chrome developer tools
Each time I edit css in chrome developer tools it automatically changes in project.
Problems:
Meteor performs concatenation of all css files even with --debug flag on. But provides source maps.
Meteor will still reload after file changes, but fortunately for styles meteor performs soft injection, I would call it, so page will not really be reloaded. It's okay and not really a problem.
Because of 1st problem and this bug I can not get it work.
This feature is very important for me in terms of productivity.
I would offer a good bounty for some guru, who could give me a direction to solve this. Maybe you point me to some starting points to make a plugin for chrome, this also would be acceptable
The way I do it is pretty simple.
Open your website
Right click -> inspect element
Click on Settings - (the wheel in the top right corner).
3.1. Select General tab and look for Sources label (around the bottom). There search for Enable CSS source maps and Auto-reload generated CSS. Check both. You can check all the features if you want.
Select Workspace tab and add the project folder.
Refresh devtools/browser and repeat everything to step 2.
Now, open the Source panel (Elements - Network - Source). Navigate through your folder and find the css file.
Right click on it and select Map to file system resouce. A window with few css files should appear (depends on your projects config).
7.1 Select the css file for your project. A popup asking you to restart devtools will appear. Click ok. Enjoy.
I haven't tested this with Meteor, but for Harpjs & static HTML files the Chrome LiveReload extension will inject changes in Chrome Dev to the actual file.

How to save CSS directly from Chrome developer tools?

I work on a local web site project and i use google chrome for testing my css.
So i want to know how can I save the changes I make in chrome css tool to my project, because i have always to copy and paste the css i put to google chrome in my file .css.
Navigate to this stylesheet in the Sources panel of the Developer
Tools, Right-click it, and Save-As this file to your computer
see here for more info
You can use special tools like Emmet LiveStyle http://livestyle.emmet.io/ so that you can edit code in Chrome and it will be automatically saved to your css files (There are more than one of them)

Chrome Dev Tools (CSS) editing and saving

I need to change the color of some words in one category of the widget, I have seen the youtube video about Development Tools.
When I locate the part where I want to change, and I do the change in "Elements" (of Development tools) on the top right corner in the element.style {color:red;
}
but as following the video when I go to resources the changes I made is not there.
I can only edit in Elements, I cant save it
I can only save in Resources, I cant edit/add anything
can someone please help me how this dev tool suppose to work?
I can however edit/add AND save in the Sources, maybe I need to save the style sheet from Resources to Sources? is that what I am suppose to do?
As you said Chrome Dev Tools don't have the builtin function to save the code you edit, anyway there are a couple of Chrome extensions. The best in my opinion is Tincr.
You can find it here Tincr
Then you can also find a tutorial here: http://addyosmani.com/blog/lets-tincr-bi-directional-editing-and-saving-with-the-chrome-devtools/.
Basically you
install the extension,
then you select the application type between: Ruby on Rails, Chrome Extension, Atlassian Plugin and Configuration file,
then you can add the root directory of your project.
When you are done, if you edit something using Google Chrome Dev Tools, the changes will be saved automatically to the source files and there is also a live reload function, so you don't have to press the refresh button or F5 to reload the page after changes.
You cannot edit files on the server through the developer tools and changes will not stay after a refresh.
An updated answer as of March 2013, you can now save changes (JS and CSS, not DOM) from within Dev Tools.
http://remysharp.com/2012/12/21/my-workflow-never-having-to-leave-devtools/

ASP.NET MVC does not catch styles when published

I have an ASP.NET MVC application that works fine when I run it on Visual Studio. But when I publish it, all the styles dont seem to work. Are there any general guidelines on why styles dont work for an MVC application when published because right now I have no clue on what is happenning??
Any ideas and suggestions are appreciated!
There are many reasons why your css styles might not show up.
Caching: Maybe your browser use a cached version of your css file(s). Check with fiddler or clear the browsers cache
Wrong relativ path to the css file(s): You should specify relative paths when including css files in your views (use Url.Content("~/...") for getting the right url). This is an issue when you use not the same path on your IIS and your IDE.
But the first check in any cas is to run fiddler and see
Is the browser requesting the right css file(s)
Is the server returning the file or a 404, 304, ... status code
It is possible that you have defined the styles in a new file and have not included the new css file in your project (in Visual Studio .net).
VS.Net does not publish those files which are not part of the project.
Get Firebug, inspect the element that should have the style applied and see what CSS is actually present.
Take a look at the CSS Panel and see the CSS files that are being linked (click the down arrow in the master.css as shown in the image below).

Resources