0.0
No commit activity in last 3 years
No release in over 3 years
Less2Sass is an easy to use converter between Less and Sass, respectively SCSS, dynamic stylesheet formats. It is based on abstract syntax tree transformation instead of the common string replacement methods using regular expressions. It does not support a lot of language features, yet. However, when finished, it will offer the developers an easy way to convert between these formats without the following manual conversion as it is today.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 11.1
~> 3.0

Runtime

~> 3.4
 Project Readme

less2sass

Gem Version Build Status

LESS and SASS are two dynamic style sheet languages with some minor differences in syntax and huge differences in their semantics. The goal of this project is to create a converter application between these formats.

There are some converters available on the Internet, but all of them are working on the search and replace principle and can not produce 100% correct conversion. Less2sass is an AST-based converter, which heavily uses the Less.js and Sass engines in order to correctly parse Less code and generate Sass or SCSS stylesheets, respectively.

Installing

  1. Install Node.js v6, if possible, according to the official instructions.

    • On Debian (Ubunu/Mint) set an alias in ~/.bashrc file for nodejs.

      alias node='nodejs'
      
  2. Set the NODE_PATH environment variable to store the install location of nodejs in your bash profile. Usually, it is the folder /usr/lib/node_modules.

    export NODE_PATH=/usr/lib/node_modules:$NODE_PATH
    
  3. Install Less.js using the Node.js package manager.

    $ sudo npm install -g less@2.7.1
    
  4. You can check, if Less.js has been installed successfully by entering the interactive node shell and trying to require it. The require should return the path to the module's index file. Usually /usr/lib/node_modules/less/index.js.

    $ node
    > require.resolve('less')
    
  5. Install Less2Sass. Note that the name of the gem is less_to_sass, since the alternative with the number was already taken.

    $ gem install less_to_sass

Usage

$ less2sass <INPUT> [OUTPUT] [options]

Even though the name of the gem is less_to_sass, the executable is used according to the repo's name.

Development

  1. Install Bundler.

    $ gem install bundler
  2. Clone git repo and enter it.

    $ git clone https://github.com/vecerek/less2sass
    $ cd less2sass
    
  3. Install development dependencies using bundler.

    $ bundle install
    
  4. Run the tests and enjoy the development!

    $ bundle exec rspec spec/compare_spec.rb
    

Language differences

There is an entire [wiki page] (https://github.com/vecerek/less2sass/wiki/Less-vs.-Sass), that deals with the language differences. It will be continuously updated as new releases of Less and Sass will be published. The current version of the document describes the differences between Less v2.7.1 and Sass v3.4.21