Visual Studio Code error during SASS task runner setup - sass

I am new to web development in general, and I am trying to setup sass following the documentation here:
https://code.visualstudio.com/docs/languages/css
However I am receiving this error:
"An output directory must be specified when compiling a directory". On
the internet people are suggesting solutions, but they are related to
configuration of other editors.
My project looks like this, so you can have an idea how my project is set up:
SASS project config screenshot
I tried adding all design files in the same folder as the tasks.json file, but it didn't work and I got the same error.
I have one more question: do I need to create the .css file, or does the task create it if it's not found?
I appreciate any help possible.

I just figured this out, while looking for the same solution.
Your "args" have to be configured like this:
"args": ["./src/app/styles.scss", "./src/app/styles.css"]
or
"args": ["./(static or assets folder)/(sass folder)/styles.scss", "./(static or assets folder)/(css folder)/styles.css"]
The "./" points to the root of the project, then simply include the appropriate folder path.
Cheers!

The default setup for the Sass Task Runner on https://code.visualstudio.com/docs/languages/css now looks like this:
// Sass configuration
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Sass Compile",
"type": "shell",
"command": "node-sass styles.scss styles.css",
"group": "build"
}
]
}
If you get the error
"An output directory must be specified when compiling a directory"
then change the configuration like:
"command": "node-sass ./<your path>/styles.scss ./<your path>/styles.css",

Related

cannot open source file "begin_code.h" (dependency of "SDL2/SDL.h")

When attempting to setup SDL2 with VS Code in Ubuntu 20.01 LTM I get the following VS Code error:
cannot open source file "begin_code.h" (dependency of "SDL2/SDL.h")
Any tips?
Just add "/usr/include/SDL2/" to your c_cpp_properties.json like so:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/SDL2/"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu18",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
in case you don't have the "c_cpp_properties.json" file in your
folder.
Different answer than above, but I believe might be a better approach.
to create the c_cpp_properties.json on your workspace
do the following:
ctrl + shift + p (opens the command palette)
search for "C/C++: Edit Configurations (JSON)" and click on it
"c_cpp_properties.json" file will be created on your workspace
add "/usr/include/SDL2/" to your "c_cpp_properties.json" like
https://stackoverflow.com/a/64187964/8540466
reload C/C++ IntelliSense extension.
I'm assuming you already have the extension
"C/C++ IntelliSense, debugging, and code browsing"
installed on your vscode.
After these steps this problem was fixed for me.
If you, like me, don't have the c_cpp_properties.json file in your project, you can solve it by adding the following line to your settings.json (in VSCode, hit Ctrl+Shift+P and search for Open settings (JSON)):
{
// ...
"C_Cpp.default.includePath": ["/usr/include/SDL2", "${default}"],
//...
}

How do you debug the cucumber step definitions w/ Visual Studio Code?

I'm using the protractor-cucumber-framework to create a testbed environment for our QA team. I've searched around and been able to find zero help in implementing VS Code's debugging capability for use in this code. Has anyone does this? I'd really like to step away from console.log() statements.
1) Upgrade your Nodejs to 8 and later
2) Create a folder .vscode under your project base directory
3) Create a file launch.json under .vscode
4) Copy below content into launch.json
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "gie",
"program": "${workspaceFolder}/node_modules/protractor/built/cli.js",
"cwd": "${workspaceFolder}",
"args": [
"config/gie.config.js",
"--browser=chrome"
]
}]
}
The ${workspaceFolder} represent your project base directory
The first value in args is your protractor config file, you can use relative path to ${workspaceFolder}
The second and next value in args is command options as you type in command line to run test.
My Environment: VSCode 1.8.1, Nodejs v8.9.0, Protractor 5.2.0,

How to compile Sass to CSS in Sublime Text 3 automatically?

For example, there is package for less LessToCss. As for Sass(or SCSS) I don't know what i should do. Ruby and sublime package Sass are installed.
You have to alter the PATH variable at the end of PATH string in the Environment Variables: Desktop - Properties - Environment Variables. It for win vista/7 users. Detail for 2000/XP here Sass compiler not working in sublime text 3
One way is to download a SASS build compiler from here: SASS Compiler
This is automatic Sublime package that simply builds your file at the place.
However since they released the new version, there seem to be multiple settings on this package - you could try to mess with that a bit and see what it can do nowdays.
Second way is to write your own Build command in Sublime. You do this by going to "Tools>Build System>New Build System..."
{
"cmd": ["sass", "--update", "$file:${project_path}/Project/Web/css/${file_base_name}.css", "--stop-on-error", "--style", "compressed", "--no-cache", "--sourcemap=none"],
"selector": "source.sass, source.scss",
"line_regex": "Line ([0-9]+):",
"osx":
{
"path": "/usr/local/bin:$PATH"
},
"windows":
{
"shell": "true"
}
}
Explanation: I use a folder structure as the following: Project/Web/CSS - If you have the Sublime Project FILE at the same level as Project FOLDER, then this will automatically build your Sass file (placed ANYWHERE in the project file) in your Web/CSS folder. Of course you can change this as you see fitting.
here is 100% solution, as i also using. Actually i am using in mac so, i am not sure about windows because i wouldn't try yet in windows but i think it will works in window's too.
so here is the build;
copy this from starting brackets and paste it into build and then save with any name like (Build to CSS),"
{
"cmd": ["sass", "--update", "$file:${file_path}/../css/${file_base_name}.css", "--stop-on-error", "--no-cache"],
"osx":
{
"path": "/user/local/bin:$PATH"
},
"windows":
{
"shell": true
}
}
If it's working then please comment.
Thanks

I try but I don't understand how build CSS from SCSS in VSCODE

All is in the title :)
How can I build css from sass file in vscode ?
In task file I just found lines for LESS not for SASS...
Thanks a lot !
I got it to work.
My root path has a /css folder underneath with my styles.scss file & the associated map file. I also had to fix my path for ruby. Once those two were working, my build showed an error where ruby couldn't find the scss file. So I fixed my task file - here is the working file. Notice the ${fileDirname} - that fixed the build errors for pathing.
{
"version": "0.1.0",
"command": "sass",
"args": ["${fileDirname}/styles.scss", "${fileDirname}/styles.css", "--trace"],
"isShellCommand": true
}
}
But this was just a test -- it doesn't watch and build more than 1 file as you would normally want to in a larger system. The docs for gulp/automation are here: https://code.visualstudio.com/Docs/languages/CSS
We don't have predefined problem matchers for SASS yet. You might want to open a feature request here https://code.visualstudio.com/Issues/List
But you can always create a problem matcher for SASS yourself. Have a look at the doc here: https://code.visualstudio.com/Docs/tasks#_defining-a-problem-matcher

Setting up sublime build file for sass/scss

I am trying to set-up automatic build of .scss files in Sublime Text 2. I keep getting the error [Error 2] The system cannot find the file specified. I've tried several configurations, but I'm just not getting it.
On my current project, the structure is like:
- 2014
- sites
- all
- themes
- 2014sub_theme
- sass
- css
I have set-up a project and within my .sublime-project file I have (complete file contents):
{
"folders":
[
{
"path": "sites/2014"
}
],
"build_systems":
[
{
"name": "SASS-Custom",
"cmd": [
"sass",
"--watch",
"sass:css"
],
"working_dir": "$project_path/sites/2014/sites/all/themes/2014sub_theme"
}
]
}
When I save, I get the following error:
[Error 2] The system cannot find the file specified
[cmd: [u'sass', u'--watch', u'sass:css']]
[dir: C:\wamp\www\sites\2014\sites\all\themes\2014sub_theme]
[path: __path stuff removed__]
[Finished]
Without a doubt, the sass folder is at C:\wamp\www\sites\2014\sites\all\themes\2014sub_theme\sass and css is at C:\wamp\www\sites\2014\sites\all\themes\2014sub_theme\css.
From cmd.exe, I do this:
cd C:\wamp\www\sites\2014\sites\all\themes\2014sub_theme
sass --watch sass:css
It works just fine, any changes to sass/global.scss are immediately compiled to css/global.css
I am using SublimeOnSaveBuild.
I ran into this same issue and spent quite a while messing with it. I know this is very late, probably too late to help you, but I'm going to answer anyway for anyone else who might stumble upon this question.
For some reason, just using "sass" fails from the ST3 build system. Change it to "sass.bat" (also a file in the same directory) and it worked for me.

Resources