Giter Site home page Giter Site logo

thiagotognoli / less2sass Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vecerek/less2sass

0.0 1.0 0.0 112 KB

Converts Less projects to Sass based on their AST instead of the search and replace approach.

License: MIT License

Ruby 94.68% JavaScript 1.39% Shell 2.87% Dockerfile 1.06%

less2sass's Introduction

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 [email protected]
    
  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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.