how can I compile SASS to CSS in Bracket IDE? - sass

I have been working coding on bracket text editor for several days but I don't know how compile my SCSS codes to CSS!!
I have also installed bracket sass extension , have I installed right extension or not? if I have, so how does it work?
this is my extension manager:

Try installing the live sass compiler. After that, prepare the settings.json file below.
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extension": ".css",
"savePath": "~",
},
{
"format": "compressed",
"extension": ".min.css",
"savePath": "~",
}
],

Related

I wanna make git bash but my default terminal but I'm getting an error because of another settings inside

Im trying to make git bash my main terminal but couldn't because of the sass live server compiler. Here is the code
terminal.integrated.profiles.windows":{"Git Bash":{"path":"C:\\Program Files\\Git\\bin\\bash.exe"}, },
"terminal.integrated.defaultProfile.windows": "Git Bash"
{
"liveSassCompile.settings.formats": [
// This is Default.
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css"
}
],
"explorer.confirmDelete": false,
"powershell.powerShellDefaultVersion": "Windows PowerShell (x86)",
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 500
}
The error Im getting is Expected a JSON object, array or literal.
VS Code is complaining that its settings file is not valid JSON, which it is indeed not. Try the following:
{
"liveSassCompile.settings.formats": [
// This is Default.
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css"
}
],
"explorer.confirmDelete": false,
"powershell.powerShellDefaultVersion": "Windows PowerShell (x86)",
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 500,
"terminal.integrated.profiles.windows": {
"Git Bash": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe"
},
},
"terminal.integrated.defaultProfile.windows": "Git Bash"
}

Visual Studio 2019 - Use project specific ESLint config .eslintrc

I have followed this guide to set up .eslintrc configuration.
https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md
I have also enabled ESLint in Visual Studio by following this guide:
https://stackoverflow.com/a/44458832/3850405
My problem is that I want to use a project specific config instead of the Global ESLint Config.
The guide sets up a .eslintrc.js file so I tried to switch to a file that had the same structure as C:\Users\Oscar\.eslintrc.
Tried placing the .eslintrc in the root folder of the solution, project and in my ClientApp folder but nothing got picked up. Is it possible to use a project specific ESLint config in Visual Studio and receive build errors/warnings?
Running the command npx eslint . --ext .js,.jsx,.ts,.tsx gives me correct errors but Visual Studio shows no errors.
.eslintrc:
{
"root": true,
"parser": "#typescript-eslint/parser",
"plugins": [
"#typescript-eslint",
"jest"
],
"extends": [
"eslint:recommended",
"plugin:#typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:react/recommended"
],
"env": {
"browser": true,
"node": true,
"jest/globals": true
},
"rules": {
"no-console": [
"error",
{ "allow": [ "warn", "error" ] }
]
}
}
I was able to get ESLint in Visual Studio 2019 to use a configuration file that I had in the root of my project.
The file is called ".eslintrc.json". Here is the contents of the file so far:
{
"extends": "eslint:recommended",
"globals": {
"kendo": "readonly"
},
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jquery": true
},
"rules": {
"no-prototype-builtins": "off",
"no-unused-vars": [
"error",
{ "args": "none" }
]
}
}
One thing I noticed is that I had close and re-open Visual Studio after adding the file before it would start working. Once I did that changes I made to the file would take effect immediately.

How to setup output path to compiled css files using 'vscode live sass compiler extension'

I would like the compiled file in folder 'RWD/homework/css', not in 'RWD/css', how can I set?
This is my setup:
{
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "./css"
}
],
"[c]": {},
"[bat]": {},
"editor.fontSize": 16
}
My target path

How to setup output path to compiled css files using `vscode live sass compiler extension` in windows10?

I failed to run node-sass(node module), where I was able to setup path for input extensions.scss files and output files generated after compiling to dist/ folder.
Now, I am using vscode extension live sass compiler,
at bottom bar, when I clicked Watched Sass then it compiled automatically scss file to css but in same folder.
main.scss is compiled to main.css.
problem is that I wanted to create that compiled css file in other folder .i.e. in output folder ./dist/.
I have manually created main.css file in ./dist/folder.
How can I setup path to source and destination files in that extension?
I have had the same issue when I started implementing SMACSS methodology to my projects. This is the solution I have tried. hope it will help you.
Go to VScode User Settings --> Select "Live Sass Compiler Config --> add
"liveSassCompile.settings.formats": [{
"format": "expanded",
"extensionName": ".css",
"savePath": "./css"
}]
Go to VScode menu- file>preferences>settings>extension>live sass copile config>edit in settings.json
and paste it code >>
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "~/../css/"
}
]
You can go to VSCode Setting.json file and add following lines after the existing configuration.
Example:
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "~/../dist/css/"
}
]
Not sure if this will help anyone since it's been a long time it was posted but I had multiple folders opened in VSCode recently and everytime I tried to use live sass compiler it would go to the folder that was on top of the list and create the css/styles.css file(s) inside that directory.
I saw this solution on the Live Sass Compiler creators website:
https://ritwickdey.github.io/vscode-live-sass-compiler/docs/faqs.html
What you do is simple, lets say you have a folder architecture
like my one here. (image link)
All you have to do is make a folder named .vscode and add a settings.json file inside that folder.
Inside settings.json paste the following code:
{
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/Parallax/css"
},
{
"extensionName": ".min.css",
"format": "compressed",
"savePath": "/Parallax/dist/css"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**"
],
"liveSassCompile.settings.generateMap": true,
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
Notice how my liveSassCompile.settings.formats is formatted: I've written the save paths as /Parallax/css/ and /Parallax/dist/css. This goes to the project root and saves the css files inside the folders called css and dist which are inside the Parallax directory. (image link)
In conclusion each time you want to change the save path all you have to do is modify the settings.json file inside the .vscode folder rather than modifying the user settings which is tedious in my opinion.
Final structure should look like this once you edited the main.scss file.
Inside your Project Create a (.vscode) Directory. In the .vscode folder create a json file named settings.json. Inside of the settings.json, type the following key-value pairs. By the way you'll get intelli-sense. I hope this will work
{
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css"
},
{
"extensionName": ".min.css",
"format": "compressed",
"savePath": "/dist/css"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**"
],
"liveSassCompile.settings.generateMap": true,
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
Go to live SassCompiler extension settings and enter below code setting in JSON file and save.
"liveSassCompile.settings.autoprefix": [],
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "~/../dist/css/"
}
None of above methods worked for me until I used the code below in the settings.json.
{
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "~/../../css/"
}
],
"editor.minimap.enabled": true,
"liveSassCompile.settings.generateMap": false
}
On the savePath line you have to keep the "~" or else it wont work.
On "editor.minimap.enabled": and "liveSassCompile.settings.generateMap":
These lines are for if you want to generate a map.css file, put "false" for no, or "true" for yes.
Add this to generate .css files in a css folder in the project root directory:
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css"
}
],
Or to generate in dist/css:
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/dist/css"
}
]
This can either be in VS Code global settings.json to apply to all projects (look for "liveSassCompile.settings.formats" and change the "savePath" line; the provided "format" and "extensionName" are already the defaults), or if you want to limit the settings to the current project, place the settings in a settings.json file within a folder named .vscode.
Refer to the Live Sass Compiler settings doc for more information: https://github.com/ritwickdey/vscode-live-sass-compiler/blob/master/docs/settings.md
Open your vs.code and go to settings then search Sass and see below Live Sass Compiler click here and see right side Live Sass Compile > Settings: Formats then edit this Settings and change only your SavePath Like example below this code.
{
"scss.format.enable": true,
"liveSassCompile.settings.autoprefix": [
],
"liveSassCompile.settings.watchOnLaunch": false,
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/assets/css", // you can change this path
"savePathReplacementPairs": null
}
]
}
Do everything as Sulara said. When you open the settings.json file, it may look like this.
{
"window.zoomLevel": 0
}
So, you need to apply the recommended settings like the following.
{
"window.zoomLevel": 0,
"liveSassCompile.settings.formats": [{
"format": "expanded",
"extensionName": ".css",
"savePath": "./css"
}]
}
You can go to VSCode Setting.json file and add following lines after the existing configuration.
Example:
src path- project_folder/sass/style.scss
output path - project_folder/css/style.css
"liveSassCompile.settings.formats": [{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css/"
}]

Configure "Live Sass Compiler" (VSCode module)

I tried to configure the module "Live Sass Compiler" to put css files in an other directory than the one with scss files, but either I got errors, or it does nothing.
I made a directory/project to test it.
Root : C:\\test_space\\sass_compiler_config
Tree:
+ sass_compiler_config
+ build
+ src
+ modules
+ variables.scss
+ style.scss
Here is the test configuration I want to use to check it works:
{
"liveSassCompile.settings.generateMap" : false,
"liveSassCompile.settings.showOutputWindow": true,
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/sass_compiler_config/build/styles"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**"
],
"liveSassCompile.settings.includeItems": [
"/sass_compiler_config/src/style.scss",
],
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
I tried creating a directory named ".vscode" with a file "settings.json" inside and add it to the workspace.
I get this error : This setting can not be applied now. It is applied when you open this folder directly.
I tried putting it in the workspace configuration:
{
"folders": [
{
"path": "C:\\test_space\\.vscode"
},
{
"path": "C:\\test_space\\sass_compiler_config"
}
],
"settings": {
{
"liveSassCompile.settings.generateMap" : false,
"liveSassCompile.settings.showOutputWindow": true,
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/sass_compiler_config/build/styles"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**"
],
"liveSassCompile.settings.includeItems": [
"/sass_compiler_config/src/style.scss",
],
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
}
}
No error, but does nothing.
Could be that my paths are wrong.
As I guess;
You want to Save location in relative from workspace root or your Sass files, if so;
* Default value is null. (null means, it will generate CSS in the location of scss/sass. By The Way, It is null, NOT "null").
* "/" denotes relative to root.
* "~" denotes relative to every sass file. - Complex Scenario.
Please check the documentation
and this is the result
Go to path: C:\Users\your user\AppData\Roaming\Code\User\settings.json
and change there the "liveSassCompile.settings.formats" section
for example:
the parameter : "savePath": "/Python/CSS",

Resources