how to install sass on windows - ruby

I cannot install Sass to my machine although I had downloaded ruby and printed on cmd :
cd C:/ruby22
then:
gem install sass
but I get as result:
'gem' is not recognized as an internal command, operable program or batch file
how to install it please?

You can install Sass on Windows by downloading the package for your operating system from GitHub select latest release
extract the downloaded zip file
Now note download the extracted zip file path. For example D:\MyUserName\dart-sass
Set system environment variable. Step depends which version of
Windows you're using:
If you're using Windows 8 or 10, press the Windows key, then search
for and select "System (Control Panel)".
If you're using Windows 7, right click the "Computer" icon on the
desktop and click "Properties". Click "Advanced system settings".
Click "Environment Variables".
Under "System Variables", find the PATH variable, select it, and
click "Edit". If there is no PATH variable, click "New".
Add your directory to the beginning of the variable value followed
by ; (a semicolon). For example, if the value was
C:\Windows\System32, change it to
C:\Users\Me\bin;C:\Windows\System32.
Click "OK".
That's all—there are no external dependencies and nothing else you need to install.
now open command prompt
run sass --version
to be sure it installed correctly.
When you install Sass on the command line, you'll be able to run the sass executable to compile .sass and .scss files to .css files. For example:
sass --watch input.scss output.css
Once it's all set up, Sass Basics.
how i am converting .scss to .css
i have created a windows batch file in my project/content/scss folder(where all my scss files are) with below commands.
cd.. (When you need to go one folder up, use the "cd.." command.)
sass --watch scss\:scss\ (You can also watch individual files or
directories with the --watch flag.)
saved it as
watch scss.bat
now whenever i am working on my sass file i run the "watch scss.bat"
the above command execute and watch my all my .scss files and update .css file for the same:)

Install ruby, see: https://github.com/oneclick/rubyinstaller/wiki
Open a command prompt, click Start, click Run, type cmd, and then click OK.
Run gem install sass
Possible related to your issue: https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file

This is for Windows
First step is to download ruby, install it, then add it to your executable path.
Now go to your folder where ruby was installed and check if it was installed with ruby -v command.
Then, open the folder where you have installed ruby and install sass using gem install sass.
That's it!! You are good to go!! If you still have doubts, run sass -v and it will give you a version.
For Mac
Just run gem install sass as ruby is preinstalled on Mac.

Step 1: https://rubyinstaller.org/ using CMD [gem install sass]
Step 2: http://compass-style.org/install/ using CMD
[gem update --system] [gem install compass]
for more details https://github.com/iz-syed/base_path/blob/master/README.md

Related

Windows Script Host Error: Invalid character - Code:800A03F6 - Source: Microsoft JScript compilation error

I'm having an issue with Powershell and CMD. When I try to execute Angular CLI commands in CMD like ng --version or ng new projectName, I get this error;
Windows Script Host Error: Invalid character
Code: 800A03F6
Source: Microsoft JScript compilation error
Update:
On Windows .js files are associated to Windows Scripting Host by default, so the script will not be run with Node.
Open a file explorer and find a JavaScript file, open the JavaScript file's properties and then "open with", select the Node.js program file to open that kind of files.
The error should stop after doing this.
This is how I solved it: (on windows 10)
Go to C:\Users\<your_username>\AppData\Roaming\npm\node_modules\#angular\cli\bin
Check for ng.js
Right click on ng.js file and click on "properties" option
You need to open it with node.exe so click on "Change" button go to node js installed directory and
(example: C:\Program Files\nodejs\node.exe)
Select node.exe
Click on OK
It should change the color of ng.js like below:
Now try ng -v and other ng commands
Installing this exact Angular version:
npm -g install #angular/cli#10.3.1
instead of the latest version:
npm -g install #angular/cli
fixed the above error.
I ran into this exact issue after updating to Angular CLI 13. Tried tons of different suggestions from other threads. What is described in the solutions here is essentially what worked for me, but I just want to point out a possible alternative method to applying the fix that doesn't associate all JS files with node.js.
Trying to execute a script from package.json on Windows throws a JScript error
In your windows system environment variables is one variable called PATHEXT. If the value contains .JS;, remove it. Then restart your CMD windows.
make sure you have proper path variable configured as shown below
Go to your system variable settings
path variable snapshot
make sure you have all these mentioned as part of path
C:\Users<userfolder>\AppData\Roaming\npm\node_modules#angular\cli
C:\Users<userfolder>\AppData\Roaming\npm
C:\Program Files\nodejs
make sure you have all these mentioned as part of path C:\Users\AppData\Roaming\npm\node_modules#angular\cli C:\Users\AppData\Roaming\npm C:\Program Files\nodejs
in my case, before npm install -g #angular/cli, the path of my system variable was:
C:\Users\AppData\Roaming\npm\node_modules#angular\cli\bin
I remove \bin and work!!!!!
Remember to fix this for the correct User
Associating .JS files to node.exe is the way to solve this.
BUT after struggling with the same issue, I wanted to add that the file association needs to be done with the same USER that you are working with the Terminal/Shell.
So if you use the Terminal as a Admin, you must login with your Admin Account just to fix the file association.
Cheers

Editing SASS files (.SCSS)

I'm a complete beginner with SASS!
I have a custom built WP site which uses SASS.
When I try to edit any styles inside the .SCSS files these changes do not show on the frontend.
I'm using VS Code editor with the "Live SASS compiler" add-on but still when I make changes they do not reflect on the front end.
I'm clearly missing something here but really don't know where to start.
All I want to do is make changes to the styling of the site!
Thanks
You will need to ensure that SASS is installed on your machine - check out the offical install link.
Once SASS is installed, the rest of this answer will involve using the command line with some basic commands.
Lets assume your CSS and SCSS/SASS folders are arranged like so:
C:/Users/Me/development
/wordpress/wp-content/themes/my-theme/assets/css
/wordpress/wp-content/themes/my-theme/assets/scss
Open up your preferred command line interface - like PowerShell or Command Prompt. First of all, check SASS is installed by typing the following command and hitting enter:
sass --version
You should get a number back - if not, you will need to run over the installation instructions again and make sure you did everything correctly.
If that's working as expected, you will now need to navigate to the directory containing your assets. When you load your command line interface, you should be inside your user or home directory - in this example that will be C:/Users/Me. If using PowerShell, you will see your current working directory before the flashing caret.
You can use the change directory command - cd - to navigate to your themes assets folder. Using the above example filepath:
cd development/wordpress/wp-content/themes/my-theme/assets
Once inside this directory, you can run the SASS --watch command to watch the directories for changes and compile upon save:
sass --watch scss:css
The above watches the SCSS folder and puts the compiled CSS in the CSS folder. Once you're done editing, hit CTRL/CMD + C inside your terminal (command line) and then Y to stop watching the SCSS files for changes.

How to install dotless on local pc, windows 10

How to install dotless on local pc from command line.
First I install Ruby, then put in console "gem install nu", then "nu install dotless".
The installation tells me for all files: "required"
Download and install Ruby 1.9.3
In command line put: gem install nu
In project folder put: nu install dotless
In project folder put: dotless less\style.less css\style.css (this item only one time, when you create a progect; you must keep your .less in folder less and .css in folder css;)
In project folder put: dotless less\style.less --watch css\style.css
When you finish coding in command line press "Enter" for stop watching

How to properly install Cabal 1.18.02 in Windows 7?

I'm trying to install the new Cabal in Windows 7. It successfully installs 1.18.02, but when I run "cabal --version" it shows 1.16. The folder C:\Users\me\AppData\Roaming\cabal\bin is at the front of my PATH.
When I directly run the 1.18 executable, I get a bunch of "cabal.exe does not exist" errors.
How can I configure Cabal to use version 1.18 by default?
There is a path conflict due the way haskell platform installs cabal.exe
As seen in this ticket
To fix it:
Delete `C:/program files(x86)/Haskell platform/lib/extralibs/bin/cabal.exe.`
In any case, you can use search tool to find which cabal.exe to delete.
I used cabal-dev to install cabal 1.18 to a sandbox, such that C:\cabal-dev\cabal-dev\bin contains the latest (1.18) cabal executable. I then set C:\Cabal-dev\cabal-dev\bin as the first Variable value in the "Path" variable in "systems variables" (as opposed to the "PATH" variable in "user variables"). That worked for me, and allowed me to keep the older build of cabal intact, (in case its needed later).
It worked for me. Good luck. Here are my exact steps:
Install cabal-dev
open command prompt anywhere
execute following command: “cabal install cabal-dev”
Install new cabal
create directory: c:\cabal-dev, cd to it
execute following command: “cabal-dev install cabal-install”
Set new, upgraded cabal path as higher priority
Close any open command prompts
run: Sysdm.cpl
Go to the “Advanced” tab
Click “Environment Variables”
Select the “Path” variable listed in the “System variables” (lower) windows
Click edit
Add following string to the beginning of the variable value:
“C:\Cabal-dev\cabal-dev\bin;”
Ok, Ok, Ok
Ensure latest cabal is being run:
Open command prompt (anywhere except c:\cabal-dev\ *)
execute following command: “cabal –V”
cabal version should be 1.18.0.2
One other possible cause of this error (aside from the cabal in extralibs problem described in another answer) is that the ld in your path can't read the .o files that GHC produces.
I hit this problem with GHC 7.8.1 RC1, and could see this going wrong by running cabal install with -v3. The 'ld' on my path was coming from Haskell Platform 2013.2.0.0.
Adding mingw\bin from the new GHC's directory to the path fixed the problem.

How execute a self contained rake build?

We have an application which is compiled using Rake (on windows). We have a new requirement that one of our clients needs to compile the source code in their own environment using a bat file.
So I need to find a way to execute a rake build without installing anything on the host environment (i.e. everything required to do the build needs to be in the source directory, ruby, gems, etc...) from a batch file.
Anyone have any clues how I could get started with this?
Download and install ruby to a folder inside your project (do not add it to your PATH). After go to this folder and delete any "uninstall" file. Go to the folder again with the console (cmd and then use cd path\to\ruby\folder) and run gem install ... to install everything you need. After add a .bat file to run your app. Something like:
#echo off
rubyfolder\bin\ruby.exe myscript.rb
This is a fully portable ruby installation, you can put it in any computer and it will work as well. (I use it as a portable ruby in my pendrive to let me play everywhere with ruby!)
PS.: rake is a script from bin, you can open it with:
rubyfolder\bin\ruby.exe rubyfolder\bin\rake

Resources