Atom snippnets not working with TAB trigger - atom-editor

I have managed to set up a few .scss snippets in Atom. They all work fine, but are not triggered when I press the TAB key. They only work when I press ENTER. When I press the TAB key it will put in a CSS declaration instead of the actual snippet. Also, when I press the ENTER key to get the snippet to appear I cannot TAB through the cursor positions that I have set up in my snippets.
Here is the code I have used:
# --------------------------------- SCSS
'.source.css.scss':
'breakpoint mobone':
'prefix': 'mobone'
'body': """
#include breakpoint(mobone) {
$1
}
"""
'breakpoint mobone-up':
'prefix': 'mobone-up'
'body': """
#include breakpoint(mobone-up) {
$1
}
"""
'breakpoint mobtwo':
'prefix': 'mobtwo'
'body': """
#include breakpoint(mobtwo) {
$1
}
"""
'breakpoint mobtwo-up':
'prefix': 'mobtwo-up'
'body': """
#include breakpoint(mobtwo-up) {
$1
}
"""
'breakpoint tabone':
'prefix': 'tabone'
'body': """
#include breakpoint(tabone) {
$1
}
"""
'breakpoint tabone-up':
'prefix': 'tabone-up'
'body': """
#include breakpoint(tabone-up) {
$1
}
"""
'breakpoint tabtwo':
'prefix': 'tabtwo'
'body': """
#include breakpoint(tabtwo) {
$1
}
"""
'breakpoint tabtwo-up':
'prefix': 'tabtwo-up'
'body': """
#include breakpoint(tabtwo-up) {
$1
}
"""
Can anyone help?
Thanks

There is likely a conflict with another package working in the same scope.
Open Atom in safe mode atom --safe to see if the snippets in snippets.cson work.
Open the keybinding-resolver (Cmd+. on Mac, Ctrl+. elsewhere) and trigger your snippets. In the lower part of your screen, it will show the command (or snippet) that executed.
At worst, you will have to go through all packages that work in the .source.css.scss scope (which presumably aren't that many.)

Related

Vue2 + Vite: css preprocessor additionalData SFC styles

So I'm working with vue 2.7.14. Moving from webpack to vite.
All my scss styles in every component (SFC) are not loading. Actually, the style is loaded in the head tag, but it is adding some url params to the url and not loading the styles to the component (see 'html output')
If I put my scss files to load with vite.config.js inside the preprocesorOption, it will load and apply styles, but I want my components styles to be load in every component.
Reproduction of the case: https://stackblitz.com/edit/vitejs-vite-n72kb6
vite.config.js
css: {
preprocessorOptions: {
scss: {
// THIS WAY ALL THE STYLES IN SFC ARE NOT LOADING
// UNLESS I ADD HERE STYLES ONE BY ONE (see last one commented)
additionalData: () => {
let prepends = '';
prepends += `$app: ${app};`;
prepends += `#import "#/style.scss";`;
prepends += `#import "#/assets/vite/scss/colors.scss";`;
// prepends += `#import "#/components/searchbar/scss/searchbar.scss";`;
return prepends;
}
},
},
},
saerchbar.vue
<template src="./searchbar.html"></template>
<!--THIS IS NOT LOADING UNLESS I ADD IT TO THE vite.config.js-->
<style lang="scss" src="./searchbar.scss"></style>
<script>...</script>
The problem here is the way Im using the additionalData function.
It seems that when using "additionalData" as a function, will completely take control and as the content is passed as the first argument, we have to manually return it:
additionalData: (content) => {
let prepends = '';
prepends += `$app: ${app};`;
prepends += `#import "#/style.scss";`;
prepends += `#import "#/assets/vite/scss/colors.scss";`;
prepends += content;
return prepends;
}
or use the "additionalData" as a sass string:
additionalData: `
$app: ${app};
#import "#/style.scss";
#import "#/assets/vite/scss/colors.scss";
`,
I used this last way as string using template literals and everything works fine now.
IMPORTANT: Avoid adding any css in additionalData as it is going to get duplicated for every component that has scss. Use it for global, variables, mixins...

How to solve SvelteKit/Svelte <style> tag with squiggly line not recognising CSS #import

As the title suggests, I have been struggling to find a solution to this squiggly line problem as part of in my Svelte files.
I have looked all over the web and unforturnately I haven't yet being able to find a solution to this error in my VS Code editor.
Please note that despite this error, the imported CSS file is cascading the variables fine and all works fine, however VS Code isn't able to recognise the lang="scss" hence the squiggly line as per screenshot.
NOTE: The imported CSS file is prepended via Svelte's preprocess configs;
Here is a link to the repo holding all the configs and codes;
https://github.com/Untested/demo-svelte
My svelte.config.js (for SvelteKit) has the following and it all resolves well, leaving no squiggles. Note that if you're using vanilla Svelte (not SvelteKit), it may be configured differently.
const config = {
kit: {
adapter: adapter(),
vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: '#use "src/variables.scss" as *;'
}}},
resolve: {
alias: {
...
}}}
},
preprocess: [
preprocess({
scss: {
prependData: '#use "src/variables.scss" as *;'
},
})
]
};

Why My custom colors are not working in my Angular material theme?

I trying to add more color to my angular material theme, I've added the success color in my style.scss by the map.deep-merge fucntion
// Custom Theming for Angular Material
// For more information: https://material.angular.io/guide/theming
#use '#angular/material' as material;
#use "sass:map";
#include material.core();
$custom-primary: material.define-palette(material.$light-blue-palette);
$custom-accent: material.define-palette(material.$blue-palette, A200, A100, A400);
$custom-warn: material.define-palette(material.$red-palette);
// extra Colors
$custom-success: material.define-palette(material.$green-palette);
$custom-danger: material.define-palette(material.$orange-palette);
$custom-theme: material.define-light-theme((
color: (
primary: $custom-primary,
accent: $custom-accent,
warn: $custom-warn,
)
));
$custom-theme: map.deep-merge(
$custom-theme,(
success: $custom-success,
danger: $custom-danger,
color:(
success: $custom-success,
danger: $custom-danger
)
)
);
#include material.all-component-themes($custom-theme);
Everything compiles correctly but when I try to apply the color to a button It looks like this
and don't have any idea why.
<button mat-raised-button color="success">Success</button>
<button mat-raised-button color="danger">Danger</button>
Curremtly I'm using "#angular/material": "^13.2.4",
I think only one step was missing: Adding .mat-success and .mat-danger CSS classes:
.mat-success {
background-color: material.get-color-from-palette($custom-success, 500);
color: material.get-color-from-palette($custom-success, 500-contrast);
}
.mat-danger {
background-color: material.get-color-from-palette($custom-danger, 500);
color: material.get-color-from-palette($custom-danger, 500-contrast);
}
I also removed the map.deep-merge, which was not necessary in this solution.
Complete theme.scss file:
// Custom Theming for Angular Material
// For more information: https://material.angular.io/guide/theming
#use "#angular/material" as material;
#include material.core();
$app-primary: material.define-palette(material.$purple-palette);
$app-accent: material.define-palette(material.$teal-palette, A200);
$app-warn: material.define-palette(material.$red-palette);
// extra Colors
$custom-success: material.define-palette(material.$green-palette);
$custom-danger: material.define-palette(material.$orange-palette);
$custom-theme: material.define-light-theme(
(
color: (
primary: $app-primary,
accent: $app-accent,
warn: $app-warn,
),
)
);
#include material.all-component-themes($custom-theme);
.mat-success {
background-color: material.get-color-from-palette($custom-success, 500);
color: material.get-color-from-palette($custom-success, 500-contrast);
}
.mat-danger {
background-color: material.get-color-from-palette($custom-danger, 500);
color: material.get-color-from-palette($custom-danger, 500-contrast);
}
Github Demo Link (unfortunately Stacklitz has problems with the custom theme)
if you used angular-CLI while building the project:
as per the official docs -
If you are using the Angular CLI, support for compiling Sass to CSS is
built-in; you only have to add a new entry to the "styles" list in
angular-cli.json pointing to the theme file (e.g.,
custom-theme.scss).
So make sure your theme is included in your angular.json and the necessary imports exist in the app.module.ts, and now you can import your theme in every file like this: #import YOUR_FILE_NAME After editing the angular.json file, you will need to run ng-serve again.
if you are not using angular-CLI:
as per the official docs -
If you are not using the Angular CLI, you can include a prebuilt theme
via a element in your index.html.
so first make sure that all the imports are correct
if neither helped:
add another import in each of the component files where mat* components are used
import { MatButtonModule } from "#angular/material/button";
Remember that when you add that import, your IDE will tell you (by greying it out) that it's not needed and can be removed.
if even that didn't help
As per latest angular material documentation you have to import modules from its respective package instead of #angular/material/
So change from:
import { MatToolbarModule , MatButtonModule, MatIconModule} from '#angular/material';
to:
import { MatToolbarModule } from '#angular/material/toolbar';
import { MatButtonModule } from '#angular/material/button';
import { MatIconModule } from '#angular/material/icon';
last resort
try building a minimal reproduction of an app using the same theme you built and post it here or try debuging it yourself (you'll be surprised by how much it can help)
and in any case after each change, if nothing happens, run ng-serve

react-step-progress bar styling customization

I am creating a progress bar using the react-step-progress[enter link description here][1] library provided in react. It already takes it own styling reference from react-step-progress/dist/index.css. But, I want to override the colors provided by them. I tried to override by creating my own sass file and giving reference to those classes but they dont seem to override the existing styles.
Can someone please help me override those styles?
I had taken reference from the following link. https://www.npmjs.com/package/react-step-progress?activeTab=readme
I have tried to override in the following way.
I imported my own scss file with the required styles I want in my tsx file.
Then I referred my respective classes in the progressbar tag like this.
iconStyles.module.scss
.ProgressBar {
.stepColor {
color:#ffffff;
background-color: #26890D;
}
}
And I have imported this class into my tsx file in the following way :
Progressbar.tsx
import styles from './iconStyles.module.scss';
import * as React from 'react';
import StepProgressBar from 'react-step-progress';
const step2Content = <h1>Step1</h1>;
const step3Content = <h1> Step 2</h1>;
const step4Content = <h1> Step3 </h1>;
export default function ProgressBar() {
// setup step validators, will be called before proceeding to the next step
function step2Validator() {
// return a boolean
}
function step3Validator() {
// return a boolean
}
// render the progress bar
return (
<div>
<StepProgressBar
className={styles.stepColor}
startingStep={0}
steps={[
{
label: 'Step1',
name: 'Step1',
content: step1Content
},
{
label: 'Step2',
name: 'Step2',
content: step2Content,
validator: step2Validator
},
{
label: 'Step3',
name: 'Step3',
content: step3Content,
validator: step3Validator
}
]} onSubmit={undefined} />
</div>
);
}
To control the class used for each step you need to use the stepClass prop rather than the className prop:
[...]
return (
<div>
<StepProgressBar
stepClass={styles.stepColor}
startingStep={0}
steps={ [...] }
onSubmit={undefined} />
</div>
);

Nextjs: eslint rule doesn't affect auto-formatting

I don't like eslint's default no-new-line behavior in else, catch and finally blocks
❌
try {
// code...
} catch {
// more code...
} finally {
// even more code...
}
It feels cluttered to me and I want to have a new line between them, like this:
✅
try {
// code...
}
catch {
// more code...
}
finally {
// even more code...
}
The good news is that I already learned that there's an eslint rule for this specific case: 👉🏽 brace-style: "stroustrup" So... I applied it to my .eslintrc file whict looks like this now:
{
"extends": ["next", "next/core-web-vitals"],
"rules": {
"brace-style": ["error", "stroustrup"]
}
}
Now the problem is I get errors when there's no new line between else/catch/finally ( great! 🎉 ), but still, every time I save, my code is auto-formatted in that default non-space undesired way ( not so great ...😕 )
How could I have this brace-style rule considered by the autoformatting when I save?

Resources