Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installation of Less2Css in Sublime Text 2, cmd path issue

I am having issues getting the Less2Css package install in Sublime Text 2. I am sure this is not a package issue but a Path issue on windows that I cant figure out. It looks as though it should all be working but currently does not.

When running from Sublime text the Error message = "lessc.cmd is not recognized as an internal or external command, operable program or batch file" which is a classic windows path issue

I can use the lessc in the correct folder but cannot run from sublime text. For sure this is a window environmental variable path issue but when I echo %path% it shows the correct destination folder of the lessc.cmd file (with no space included after ;).

I have restarted my console and computer and done a setx lessc "c:\path..." with no luck.

Any help on how to get the lessc.cmd running properly would be appreciated

like image 356
Zane Avatar asked Dec 12 '22 16:12

Zane


1 Answers

I am using this settings. Some things you've already done, but I am writing all the steps I did and that work for me. I hope it can help you:

1- Install node.js
2- Install Less with npm install -g less
3- Install LESS syntax for Sublime
4- Install Less2css package

Restart Sublime (or restart Windows for the new installed variable path take effect. I'm not sure if adding a new path on windows works without restart), go to Preferences > Package Settings > Less2css > Settings - User and put this settings:

{
  "autoCompile": true,      
  "lessBaseDir": "./",
  "main_file": "bootstrap.less",
  "minify": true,
  "outputDir": "auto",
  "outputFile": ""
}

In this case I'm using Twitter Bootstrap with the structure below and when I save less/bootstrap.less or any other less file in the folder, the plugin auto compile everything in css/bootstrap.css minified (optional, check the project Github page for documentation).

assets/
  ├── css/
  │   ├── bootstrap.css
  └── less/
      ├── bootstrap.less
      ├── ...
      └── variables.less

This settings make the work faster with Less because you don't need to compile manually or use the less.js file to compile on client side. And you just need to save, don't need to install Less-build or other build tool.

like image 131
thiagobraga Avatar answered Apr 17 '23 05:04

thiagobraga