Code Monkey home page Code Monkey logo

sass2scss's Introduction

sass2scss

Build Status

C++ tool/library to convert indented sass syntax to the newer scss syntax. This was initially a port of a previous perl implementation. Its primary intention was to bring indented sass syntax support to libsass. sass2scss is included in libsass since version 2.0.

Unit Tests

I added around 60 unit tests for sass2sccs to the libsass perl binding CSS-Sass.

Command Line Utility

sass2scss [options] < file.sass
-p, --pretty       pretty print output
-c, --convert      convert src comments
-s, --strip        strip all comments
-k, --keep         keep all comments
-h, --help         help text
-v, --version      version information

The source Sass is read from stdin and the resulting SCSS is printed to stdout.

--pretty can be repeated up to 3 times to add even more linefeeds (lf).

  • 0: Write everything on one line (minimized)
  • 1: Add lf after opening bracket (lisp style)
  • 2: Add lf after opening and before closing bracket (1TBS style)
  • 3: Add lf before/after opening and before closing (allman style)

The lisp style is the only output style that should not alter the line count of the input file. This is the best option if you still want to use source-maps, since it should only change the source by a few inserted chars. So far sass2sccs does not produce source-maps and libsass will not be able to produce 100% accurate source-maps for indented sass syntax input files!

Use examples

The original Sass file, called styles.sass:

#main
  // This is the best color since it has a specific meaning
  color: rebeccapurple
  font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka
  font-size: 75%

For example with default options, running

sass2scss < styles.sass > styles.scss

Would result the file styles.scss to look like:

#main { color: rebeccapurple;font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka;font-size: 75%; }

When adding options for pretty printing (-p) and keeping comments (-k):

#main {
  // This is the best color since it has a specific meaning
  color: rebeccapurple;
  font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka;
  font-size: 75%; }

With two pretty (-p -p) and comment conversion (-c) options, the output becomes:

#main {
  /* This is the best color since it has a specific meaning */
  color: rebeccapurple;
  font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka;
  font-size: 75%;
}

License

Licensed under the MIT License.

Copyright (c) Marcel Greter

sass2scss's People

Contributors

bowd avatar hamptonmakes avatar mgreter avatar paazmaya avatar pdufour avatar

Watchers

 avatar  avatar  avatar

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.