vs code live sass compiler not updating files - css

So someone has asked something fairly similar before but didn't get an answer.
I am learning SASS and am using the live sass compiler in vs code but it is not updating anything. The only way I can get the app.css file to show the changes is to press the watching button and basically reset the thing. It didn't used to do this. All changes were shown as soon as I saved the file. There doesn't seem to be anything in the output terminal that shows an issue. Is this the only way to see live changes in sass files when working in a local environment or is there a better way.
.header {
height: 8vh;
background-color: #131921;
position: sticky;
top: 0;
z-index: 100;
align-items: center;
display: flex;
color: #fff;
padding: 30px 20px;
&__logo {
width: 100px;
object-fit: contain;
margin: 0 20px;
}
&__search {
display: flex;
flex: 1;
align-items: center;
border-radius: 35px;
}
&__searchIcon {
padding: 5px;
height: 36px !important;
width: 36px !important;
background-color: #cd9042;
border-radius: 0 6px 6px 0 !important;
}
&__searchInput {
padding: 10px;
border: none;
width: 100%;
border-radius: 6px 0 0 6px !important;
}
&__nav {
display: flex;
justify-content: space-evenly;
}
&__boxes {
display: flex;
flex-direction: column;
align-items: flex-start;
color: #fff;
margin: 0 10px;
text-transform: capitalize;
text-align: left;
}
&__boxesFirstLine {
font-size: 12px;
line-height: 14px;
font-weight: 400;
color: rgba(255, 255, 255, 0.7);
}
&__boxesSecondLine {
font-size: 14px;
font-weight: 700;
line-height: 15px;
padding-bottom: 5px;
padding-right: 9px;
}
&__basketText {
color: #fff;
font-size: 14px;
line-height: 15px;
font-weight: 700;
padding-bottom: 5px;
padding-right: 9px;
text-transform: capitalize;
}
}

For all those facing issues with Live Sass Compiler not watching. Here is the solution.
After our extension is installed in VScode, we are going to look at some settings.
Go to settings (Click on the settings icon on bottom-left corner of your VSCode, and in the menu that appears click on settings).
Then a Search field will appear at the top, we will type and search for Live Sass Compiler.
Click on Live Sass Compiler once it appears and again click on Edit in Settings.json link and add following json:
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/dist/css"
}
],
Save and we are good to go.
STEPS: Providing Images for ease.
Now FOLDER STRUCTURE:
a) After creating your project folder in any of your Disk drives. Open it in VSCode and create the dist folder within project folder/ root of your project. And create an index.html file within the dist folder.
b) Then create another folder within the root folder and we are going to name it scss and within here we are going to create a main.scss.
c) Then we can click on Watch Sass at the bootom of VSCode, Now Live Sass Compiler will keep watching for any changes in the main.scss and based on our path set in settings.json, it will automatically create the css folder within the dist folder and a main.css file as well which ultimately goes to production.

Related

CSS font size and bootstrap modal size changes when deploying compared to local browser

I have created a web app using plotly with CCS files in my assets folder. When running the app locally it all looks great. However, when uploading to AWS on Elastic Beanstalk my font sizes get quite a lot bigger. Most notably within bootstrap components (banner and modal). I have found several people asking this question, and I have tried their solutions (webpage zooming and media min-width) but it doesn't seem to work. Does anyone have any ideas? I would be very appreciative as the deployed app doesn't look very good at all!
Below is the relevant code (I think)
CSS
body {
background-color: white;
color: black;
margin: 0px;
padding-left: 1vw;
padding-right: 1vw;
font-size: 10px;
width: 100%;
height: 100%;
overflow-x: hidden;
}
h1 {
font-family: "Open Sans";
font-weight: bold;
letter-spacing: 0.2em;
font-size: 2.2em;
padding-left: 0.9em;
}
h2 {
font-family: "Open Sans";
font-weight: bold;
letter-spacing: 0.3em;
font-size: 1.7em;
padding-left: 0em;
padding-bottom: 0.6em;
}
.username-login {
float: right;
padding-right: 1vw;
padding-top: 3vh;
display: inline-block;
justify-content: left;
text-align: left;
}
.username-text {
text-align: center;
padding-right: 0.5vw;
display: inline-block;
color: grey;
line-height: 25px;
/*justify-content: center;*/
}
Python code:
app = dash.Dash(
__name__,
external_stylesheets=[dbc.themes.BOOTSTRAP],
meta_tags=[
{
'charset': 'utf-8',
},
{
'name': 'viewport',
'content': 'width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1'
}
]
)
#Info is the modal css but written as a python dictionary
info_overall = {
'zIndex': '100',
'max-width': 'none',
'overflow-y': 'auto',
'max-height': '80vh',
'position': 'relative',
'margin': 'auto',
'width': '80vw',
'background': '#1e1e1e',
'top': '18%',
}
info_body={
'background':'grey',
'display': 'grid',
'grid-template-columns':'auto auto auto auto auto',
'grid-template-rows': 'auto auto auto auto',
}
You can see that the modal is bigger on the deployed app (overlaps a button) as well as the name and logout text. Many thanks in advance! As you can probably tell I am very new to this!
Deployed APP:
Local APP:
Just an idea here, this could be caused by having different versions of a library in your local and production environments eg. dash-bootstrap-components.
You can use your browser's developer tools to get the css and html code from both versions, and use diff to see if there is any difference, this could also help you narrow down the problem.

How do I change the style used in an NPM package?

This might be a stupid or wrong question but what is the scope of an NPM package's default styling? If I'm using an NPM package but want to modify the color of one of their displays how do I got about doing that?
In my own index.css file and in the package's css file I've changed a background color of one of the divs. It works in my local environment but not in deployment-- it reverts back to the default.
In my index.css file:
.react-slideshow-container + div.indicators > .each-slideshow-indicator {
width: 7px;
height: 7px;
margin: 0 5px 10px;
border-radius: 50%;
background: white;
cursor: pointer;
}
In my node-modules/react-slideshow-image/components/general.css file:
.react-slideshow-container + div.indicators > .each-slideshow-indicator {
width: 7px;
height: 7px;
margin: 0 5px 10px;
border-radius: 50%;
background: white;
cursor: pointer;
}
This is correct. I wouldn't edit the node module directly. However, you should increase specificity to prioritize your custom CSS. For example:
.your-custom-container .react-slideshow-container + div.indicators > .each-slideshow-indicator {
width: 7px;
height: 7px;
margin: 0 5px 10px;
border-radius: 50%;
background: white;
cursor: pointer;
}
In the event that in the production site the style sheet does not reflect right away, consider refreshing your cache as necessary (e.g., ctrl+f5).

Override bootstrap css only in one react component

so I'm using a gorgeous search bar component that I found on codepen in my react (CRA) project.
I have imported css in the default src/index.js
Then I have my search component which is composed of Search.js and Search.module.css.
Clearly Bootstrap styling and the Search component styling doesn't work together, when I comment the bootstrap file import in src/index.js, the Search component will be working fine.
So how can I override bootstrap only on my Search Component?
Here is the css of the Search.module.css
#import url("https://fonts.googleapis.com/css?family=Roboto:400,400i,700");
* {
font-family: Roboto, sans-serif;
padding: 0;
margin: 0;
}
.flexbox {
background: linear-gradient(155deg, #cccccc, #e8ecee, #d4d4d4);
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.search {
margin: 20px;
}
.search>h3 {
font-weight: normal;
}
.search>h1,
.search>h3 {
color: white;
margin-bottom: 15px;
text-shadow: 0 1px #eaeff1;
}
.search>div {
display: inline-block;
position: relative;
}
.search>div:after {
content: "";
background: white;
width: 4px;
height: 20px;
position: absolute;
top: 40px;
right: 2px;
transform: rotate(135deg);
box-shadow: 1px 0 #eaeff1;
}
.search>div>input {
color: white;
font-size: 16px;
background: transparent;
width: 25px;
height: 25px;
padding: 10px;
border: solid 3px white;
outline: none;
border-radius: 35px;
box-shadow: 0 1px #eaeff1;
transition: width 0.5s;
}
.search>div>input::placeholder {
color: #5a5a5a;
opacity: 1;
}
.search>div>input::-ms-placeholder {
color: #efefef;
}
.search>div>input::-ms-input-placeholder {
color: #5a5a5a;
}
.search>div>input:focus,
.search>div>input:valid {
width: 250px;
}
As you haven't shared the code snippets. I am assuming the bootstrap search will be using: text and button tag. Now, the CSS of this would be coming from bootstrap.
You can do the following:
1) Make a search component level class eg "search-module"
2) Now, create css or scss file import in the search component and within that css
override the bootstrap css by :
.search-module input[type=search] {...}
OR
3) you can do this overriding on your main style.css file too.
You need do to step 2 for all the other conflicting classes, tags, and IDs in the bootstrap with the search component.
PS: This will bloat your CSS. Best would be if you can just pick that part of Bootstrap which is required and rest you write your own style.
Thank you.

Customize AWS cognito sign in page CSS through cognitoConfig.yaml file

I am automating the creating userpool process in AWS Cognito. I am using a yaml file to set the whole thing (i.e. user attributes, IDP, etc...). I need to customize the sign in page, and I know enough that I need to add CSS to specific list of classes. I don't understand where or the format.
This is how I did it. You can now make use of the AWS::Cognito::UserPoolIdentityProvider resource
UserPoolUICustomization:
Type: AWS::Cognito::UserPoolUICustomizationAttachment
Properties:
UserPoolId: !Ref CognitoUserPool
ClientId: !Ref CognitoUserPoolClient2
CSS: ".logo-customizable {
max-width: 100%;
max-height: 100%;
}
.banner-customizable {
padding: 0px 0px 5px 0px;
background-color: #fff;
}
.label-customizable {
font-weight: 400;
}
.textDescription-customizable {
padding-top: 10px;
padding-bottom: 10px;
display: block;
font-size: 16px;
}
.idpDescription-customizable {
padding-top: 10px;
padding-bottom: 10px;
display: block;
font-size: 16px;
}
.legalText-customizable {
color: #747474;
font-size: 11px;
}
.submitButton-customizable {
font-size: 14px;
font-weight: bold;
margin: 20px 0px 10px 0px;
height: 40px;
width: 100%;
color: #fff;
background-color: #337ab7;
}"
You can modify the css classes provided and use AWS CLI to push updates.
background-customizable
banner-customizable
errorMessage-customizable
idpButton-customizable
idpButton-customizable:hover
inputField-customizable
inputField-customizable:focus + few more.
AWS provides the list of classes used on cognito user pool UI which you can modify.
use --css ".classname{field : value}" with aws cognito-idp set-ui-customization command to update.
Like :-
aws cognito-idp set-ui-customization --user-pool-id <your-user-pool-id> --client-id
<your-app-client-id> --image-file <path-to-logo-image-file> --css ".label-
customizable{ color: <color>;}"

Jekyll Horizontal Nav Bar Troubles

I am attempting to make a horizontal navigation bar in a jekyll site. I am not sure if the CSS I am using is incorrect, or if it's not compiling correctly with Jekyll.
Here is my current approach:
- Make changes in _scss/_layout.css
- Check the changes are there in _site/main.css (they are)
- Check for errors in jekyll serve console (don't see any)
When I look at my generated site and hit inspect, I don't see the CSS changes being applied.
Sass code in _sass/_layout.scss:
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li {
list-style-type: none;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
font-weight: 200;
}
header {
background: $header;
padding: 0px 15px;
text-align: center;
margin: 50px 0 0;
height: 50vh;
display: flex;
justify-content: center;
align-items: center;
}
Full repo for my site is here - https://github.com/ericadohring/groupdayout/ and help would be greatly appreciated!
Github pages isn't showing changes anymore because there is an error that prevents Jekyll to build your site.
In _sass/_layout.scss there is a property that is using an undefined variable:
header {
background: $header;
...
}
To fix it just assign a value to it before using the variable, e.g.:
$header: #f0ad4e;
header {
background: $header;
...
}
Now you will be able to work on your site and seeing the changes reflected in Github pages.

Resources